From 6bff95c5978a0d4e0cb7e99232a1e61678fcf81b Mon Sep 17 00:00:00 2001 From: Michael Levin Date: Sat, 3 Oct 2009 11:18:02 +0000 Subject: * Per Lakitu7's suggestion, changed spectator bounding box to match the dretch bounding box. Prevents spectators from getting stuck in the floor. * Buildables round their health up when encoding health information for transmission, no more 0 hp buildables that aren't dead * Removed the devmap credits hack I put in earlier * Can now use \itemact weapon to switch to weapon, also \itemact weapon/blaster will not repeatedly force a weapon change if that weapon is already selected * Options menu entry for "Sprint" changed to "Sprint / Dodge" with correct bind (+button6) Norfenstein decided to switch to fractional "frags" (aka evos) for Aliens: * BG_ClassCanEvolveFromTo rewritten to be more robust in case classes are shuffled around later * CG_AtHighestClass and BG_UpgradeClassAvailable merged into BG_AlienCanEvolve * Changed BG_GetValueOfHuman to BG_GetValueOfPlayer which now accomodates Aliens too * Aliens now must receive 400 credits per frag point (9 evos = 3600 credits!) * Aliens can only spend whole points * TK/Suicide penalties moved to tremulous.h and converted to credit values * Complex nasty Alien land goes bye-bye --- src/cgame/cg_draw.c | 17 +++-- src/cgame/cg_local.h | 1 - src/cgame/cg_players.c | 28 --------- src/cgame/cg_tutorial.c | 4 +- src/game/bg_misc.c | 163 ++++++++++++++++++++++++------------------------ src/game/bg_public.h | 5 +- src/game/g_active.c | 4 +- src/game/g_buildable.c | 9 ++- src/game/g_client.c | 10 +-- src/game/g_cmds.c | 35 +++++++---- src/game/g_combat.c | 112 +++++---------------------------- src/game/g_weapon.c | 2 +- src/game/tremulous.h | 14 +++-- src/ui/ui_main.c | 75 +++++++++++----------- ui/ingame_options.menu | 4 +- 15 files changed, 192 insertions(+), 291 deletions(-) diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index c8f75da0..374c7a75 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -316,14 +316,17 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p value = ps->persistant[ PERS_CREDIT ]; if( value > -1 ) { - if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS && - !CG_AtHighestClass( ) ) + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) { - if( cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME ) + if( !BG_AlienCanEvolve( cg.predictedPlayerState.stats[ STAT_PCLASS ], + value, cgs.alienStage ) && + cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME && + ( ( cg.time - cg.lastEvolveAttempt ) / 300 ) & 1 ) { - if( ( ( cg.time - cg.lastEvolveAttempt ) / 300 ) % 2 ) - color[ 3 ] = 0.0f; + color[ 3 ] = 0.0f; } + + value /= ALIEN_CREDITS_PER_FRAG; } trap_R_SetColor( color ); @@ -1931,7 +1934,9 @@ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color ) } } - if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS && CG_AtHighestClass( ) ) + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS && + !BG_AlienCanEvolve( cg.predictedPlayerState.stats[ STAT_PCLASS ], + ps->persistant[ PERS_CREDIT ], cgs.alienStage ) ) { if( cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME ) { diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 00ddb519..f14c7b40 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1619,7 +1619,6 @@ void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin ); sfxHandle_t CG_CustomSound( int clientNum, const char *soundName ); void CG_PlayerDisconnect( vec3_t org ); void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum ); -qboolean CG_AtHighestClass( void ); // // cg_buildable.c diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index ad517800..95ec60bb 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2464,31 +2464,3 @@ void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum ) } } -/* -=============== -CG_AtHighestClass - -Is the local client at the highest class possible? -=============== -*/ -qboolean CG_AtHighestClass( void ) -{ - int i; - qboolean superiorClasses = qfalse; - - for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) - { - if( BG_ClassCanEvolveFromTo( - cg.predictedPlayerState.stats[ STAT_PCLASS ], i, - ALIEN_MAX_KILLS, 0 ) >= 0 && - BG_FindStagesForClass( i, cgs.alienStage ) && - BG_ClassIsAllowed( i ) ) - { - superiorClasses = qtrue; - break; - } - } - - return !superiorClasses; -} - diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index bfcd03ac..7d08a6d2 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -671,7 +671,9 @@ const char *CG_TutorialText( void ) va( "Press %s to enter the hovel\n", CG_KeyNameForCommand( "+button7" ) ) ); } - else if( BG_UpgradeClassAvailable( ps ) ) + else if( BG_AlienCanEvolve( ps->stats[ STAT_PCLASS ], + ps->persistant[ PERS_CREDIT ], + cgs.alienStage ) ) { Q_strcat( text, MAX_TUTORIAL_TEXT, va( "Press %s to evolve\n", diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 79ff31d5..8ea8ff41 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1569,11 +1569,11 @@ classAttributes_t bg_classList[ ] = 1.0f, //float shadowScale; "", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages - { -15, -15, -15 }, //vec3_t mins; - { 15, 15, 15 }, //vec3_t maxs; - { 15, 15, 15 }, //vec3_t crouchmaxs; - { -15, -15, -15 }, //vec3_t deadmins; - { 15, 15, 15 }, //vec3_t deadmaxs; + { -12, -12, -12 }, //vec3_t mins; + { 12, 12, 12 }, //vec3_t maxs; + { 12, 12, 12 }, //vec3_t crouchmaxs; + { -12, -12, -12 }, //vec3_t deadmins; + { 12, 12, 12 }, //vec3_t deadmaxs; 0.0f, //float zOffset 0, 0, //int viewheight, crouchviewheight; 0, //int health; @@ -2046,7 +2046,7 @@ classAttributes_t bg_classList[ ] = 1.0f, //float knockbackScale; { PCL_NONE, PCL_NONE, PCL_NONE }, //int children[ 3 ]; 0, //int cost; - 0 //int value; + ALIEN_CREDITS_PER_FRAG //int value; }, { PCL_HUMAN_BSUIT, //int classnum; @@ -2086,7 +2086,7 @@ classAttributes_t bg_classList[ ] = 1.0f, //float knockbackScale; { PCL_NONE, PCL_NONE, PCL_NONE }, //int children[ 3 ]; 0, //int cost; - 0 //int value; + ALIEN_CREDITS_PER_FRAG //int value; }, }; @@ -2814,45 +2814,79 @@ float BG_FindBuildDistForClass( int pclass ) BG_ClassCanEvolveFromTo ============== */ -int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num ) +int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int stage, + int cost ) { - int i, j, cost; - - cost = BG_FindCostOfClass( tclass ); - - //base case - if( credits < cost ) - return -1; + int i, j, best, value; - if( fclass == PCL_NONE || tclass == PCL_NONE ) + if( credits < cost || fclass == PCL_NONE || tclass == PCL_NONE || + fclass == tclass ) return -1; for( i = 0; i < bg_numPclasses; i++ ) { - if( bg_classList[ i ].classNum == fclass ) + if( bg_classList[ i ].classNum != fclass ) + continue; + + best = credits + 1; + for( j = 0; j < 3; j++ ) { - for( j = 0; j < 3; j++ ) - if( bg_classList[ i ].children[ j ] == tclass ) - return num + cost; + int thruClass, evolveCost; + + thruClass = bg_classList[ i ].children[ j ]; + if( thruClass == PCL_NONE || !BG_FindStagesForClass( thruClass, stage ) || + !BG_ClassIsAllowed( thruClass ) ) + continue; + + evolveCost = BG_FindCostOfClass( thruClass ) * ALIEN_CREDITS_PER_FRAG; + if( thruClass == tclass ) + value = cost + evolveCost; + else + value = BG_ClassCanEvolveFromTo( thruClass, tclass, credits, stage, + cost + evolveCost ); - for( j = 0; j < 3; j++ ) - { - int sub; + if( value >= 0 && value < best ) + best = value; + } - cost = BG_FindCostOfClass( bg_classList[ i ].children[ j ] ); - sub = BG_ClassCanEvolveFromTo( bg_classList[ i ].children[ j ], - tclass, credits - cost, num + cost ); - if( sub >= 0 ) - return sub; - } + return best <= credits ? best : -1; + } - return -1; //may as well return by this point + Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_ClassCanEvolveFromTo\n" ); + return -1; +} + +/* +============== +BG_AlienCanEvolve +============== +*/ +qboolean BG_AlienCanEvolve( int pclass, int credits, int stage ) +{ + int i, j, tclass; + + for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) + { + if( bg_classList[ i ].classNum != pclass ) + continue; + + for( j = 0; j < 3; j++ ) + { + tclass = bg_classList[ i ].children[ j ]; + if( tclass != PCL_NONE && BG_FindStagesForClass( tclass, stage ) && + BG_ClassIsAllowed( tclass ) && + credits >= BG_FindCostOfClass( tclass ) * ALIEN_CREDITS_PER_FRAG ) + return qtrue; } + + return qfalse; } - return -1; + Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_AlienCanEvolve\n" ); + return qfalse; } + /* ============== BG_FindValueOfClass @@ -5399,36 +5433,29 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, /* =============== -BG_GetValueOfHuman +BG_GetValueOfPlayer -Returns the kills value of some human player +Returns the credit value of a player =============== */ -int BG_GetValueOfHuman( playerState_t *ps ) +int BG_GetValueOfPlayer( playerState_t *ps ) { - int i, worth = 0; - float portion; - - for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) - { - if( BG_InventoryContainsUpgrade( i, ps->stats ) ) - worth += BG_FindPriceForUpgrade( i ); - } + int i, worth = 0; + + worth = BG_FindValueOfClass( ps->stats[ STAT_PCLASS] ); - for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) + // Humans have worth from their equipment as well + if( ps->stats[ STAT_PTEAM ] == PTE_HUMANS ) { - if( BG_InventoryContainsWeapon( i, ps->stats ) ) - worth += BG_FindPriceForWeapon( i ); + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) + if( BG_InventoryContainsUpgrade( i, ps->stats ) ) + worth += BG_FindPriceForUpgrade( i ); + for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) + if( BG_InventoryContainsWeapon( i, ps->stats ) ) + worth += BG_FindPriceForWeapon( i ); } - - portion = worth / (float)HUMAN_MAXED; - - if( portion < 0.01f ) - portion = 0.01f; - else if( portion > 1.0f ) - portion = 1.0f; - - return ceil( ALIEN_MAX_SINGLE_KILLS * portion ); + + return worth; } /* @@ -5634,34 +5661,6 @@ void BG_ParseCSVBuildableList( const char *string, buildable_t *buildables, int buildables[ i ] = BA_NONE; } -/* -============ -BG_UpgradeClassAvailable -============ -*/ -qboolean BG_UpgradeClassAvailable( playerState_t *ps ) -{ - int i; - char buffer[ MAX_STRING_CHARS ]; - stage_t currentStage; - - trap_Cvar_VariableStringBuffer( "g_alienStage", buffer, MAX_STRING_CHARS ); - currentStage = atoi( buffer ); - - for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) - { - if( BG_ClassCanEvolveFromTo( ps->stats[ STAT_PCLASS ], i, - ps->persistant[ PERS_CREDIT ], 0 ) >= 0 && - BG_FindStagesForClass( i, currentStage ) && - BG_ClassIsAllowed( i ) ) - { - return qtrue; - } - } - - return qfalse; -} - typedef struct gameElements_s { buildable_t buildables[ BA_NUM_BUILDABLES ]; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index cc789c1f..61195fe1 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1110,7 +1110,7 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, 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_GetValueOfHuman( playerState_t *ps ); +int BG_GetValueOfPlayer( playerState_t *ps ); int BG_FindBuildNumForName( char *name ); int BG_FindBuildNumForEntityName( char *name ); @@ -1179,7 +1179,8 @@ int BG_FindSteptimeForClass( int pclass ); qboolean BG_ClassHasAbility( int pclass, int ability ); weapon_t BG_FindStartWeaponForClass( int pclass ); float BG_FindBuildDistForClass( int pclass ); -int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num ); +int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int alienStage, int num ); +qboolean BG_AlienCanEvolve( int pclass, int credits, int alienStage ); int BG_FindCostOfClass( int pclass ); int BG_FindValueOfClass( int pclass ); void BG_InitClassOverrides( void ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 242cdc67..4d35b6a0 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1777,7 +1777,9 @@ void ClientThink_real( gentity_t *ent ) if( i == num && client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) { - if( BG_UpgradeClassAvailable( &client->ps ) ) + if( BG_AlienCanEvolve( client->ps.stats[ STAT_PCLASS ], + client->ps.persistant[ PERS_CREDIT ], + g_alienStage.integer ) ) { //no nearby objects and alien - show class menu G_TriggerMenu( ent->client->ps.clientNum, MN_A_INFEST ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 721e3fae..33803877 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2635,8 +2635,6 @@ void G_BuildableThink( gentity_t *ent, int msec ) int bRegen = BG_FindRegenRateForBuildable( ent->s.modelindex ); int bTime = BG_FindBuildTimeForBuildable( ent->s.modelindex ); - //pack health, power and dcc - //toggle spawned flag for buildables if( !ent->spawned && ent->health > 0 ) { @@ -2644,9 +2642,10 @@ void G_BuildableThink( gentity_t *ent, int msec ) ent->spawned = qtrue; } + // pack health, power and dcc ent->dcc = ( ent->biteam != BIT_HUMANS ) ? 0 : G_FindDCC( ent ); - - ent->s.generic1 = (int)( ( (float)ent->health / (float)bHealth ) * B_HEALTH_MASK ); + ent->s.generic1 = (int)( ( ent->health + bHealth / B_HEALTH_MASK - 1 ) * + B_HEALTH_MASK / bHealth ); if( ent->s.generic1 < 0 ) ent->s.generic1 = 0; @@ -2676,7 +2675,7 @@ void G_BuildableThink( gentity_t *ent, int msec ) if( ent->biteam == BIT_ALIENS && bRegen && ( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time ) { - ent->health += bRegen; + ent->health += bRegen; } else if( ent->biteam == BIT_HUMANS && ent->dcc && ( ent->lastDamageTime + HUMAN_REGEN_DAMAGE_TIME ) < level.time ) diff --git a/src/game/g_client.c b/src/game/g_client.c index b1b07df4..b8fd8472 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -93,7 +93,7 @@ void G_AddCreditToClient( gclient_t *client, short credit, qboolean cap ) client->pers.credit += credit; capAmount = client->pers.teamSelection == PTE_ALIENS ? - ALIEN_MAX_KILLS : HUMAN_MAX_CREDITS; + ALIEN_MAX_FRAGS * ALIEN_CREDITS_PER_FRAG : HUMAN_MAX_CREDITS; if( client->pers.credit > capAmount ) client->pers.credit = capAmount; @@ -1590,14 +1590,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue ); VectorCopy( ent->client->ps.origin, ent->r.currentOrigin ); trap_LinkEntity( ent ); - - // if this is devmap, give them some credits - if( g_cheats.integer && ent != spawn ) - { - int credits = ent->client->pers.teamSelection == PTE_HUMANS ? 1000 : 5; - - G_AddCreditToClient( ent->client, credits, qtrue ); - } } // must do this here so the number of active clients is calculated diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 2703c2f7..6b2e94c2 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1528,7 +1528,6 @@ void Cmd_Class_f( gentity_t *ent ) vec3_t infestOrigin; pClass_t currentClass = ent->client->pers.classSelection; pClass_t newClass; - int numLevels; int entityList[ MAX_GENTITIES ]; vec3_t range = { AS_OVER_RT3, AS_OVER_RT3, AS_OVER_RT3 }; vec3_t mins, maxs; @@ -1627,6 +1626,8 @@ void Cmd_Class_f( gentity_t *ent ) //if we are not currently spectating, we are attempting evolution if( ent->client->pers.classSelection != PCL_NONE ) { + int cost; + if( ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) || ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) { @@ -1668,16 +1669,13 @@ void Cmd_Class_f( gentity_t *ent ) return; } - numLevels = BG_ClassCanEvolveFromTo( currentClass, - newClass, - (short)ent->client->ps.persistant[ PERS_CREDIT ], 0 ); + cost = BG_ClassCanEvolveFromTo( currentClass, newClass, + ent->client->ps.persistant[ PERS_CREDIT ], + g_alienStage.integer, 0 ); if( G_RoomForClassChange( ent, newClass, infestOrigin ) ) { - //...check we can evolve to that class - if( numLevels >= 0 && - BG_FindStagesForClass( newClass, g_alienStage.integer ) && - BG_ClassIsAllowed( newClass ) ) + if( cost >= 0 ) { ent->client->pers.evolveHealthFraction = (float)ent->client->ps.stats[ STAT_HEALTH ] / (float)BG_FindHealthForClass( currentClass ); @@ -1688,7 +1686,7 @@ void Cmd_Class_f( gentity_t *ent ) ent->client->pers.evolveHealthFraction = 1.0f; //remove credit - G_AddCreditToClient( ent->client, -(short)numLevels, qtrue ); + G_AddCreditToClient( ent->client, -cost, qtrue ); ent->client->pers.classSelection = newClass; ClientUserinfoChanged( clientNum ); VectorCopy( infestOrigin, ent->s.pos.trBase ); @@ -1714,7 +1712,7 @@ void Cmd_Class_f( gentity_t *ent ) //humans cannot use this command whilst alive trap_SendServerCommand( ent-g_entities, "print \"You must be dead to use the class command\n\"" ); - return; + return; } } @@ -1854,13 +1852,26 @@ void Cmd_ActivateItem_f( gentity_t *ent ) int upgrade, weapon; trap_Argv( 1, s, sizeof( s ) ); + + // "weapon" aliased to whatever weapon you have + if( !Q_stricmp( "weapon", s ) ) + { + if( ent->client->ps.weapon == WP_BLASTER ) + G_ForceWeaponChange( ent, WP_NONE ); + return; + } + upgrade = BG_FindUpgradeNumForName( s ); weapon = BG_FindWeaponNumForName( s ); if( upgrade != UP_NONE && BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) BG_ActivateUpgrade( upgrade, ent->client->ps.stats ); - else if( weapon != WP_NONE && BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) - G_ForceWeaponChange( ent, weapon ); + else if( weapon != WP_NONE && + BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) + { + if( ent->client->ps.weapon != weapon ) + G_ForceWeaponChange( ent, weapon ); + } else trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) ); } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 3991adf4..6acc12e2 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -210,9 +210,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int //punish team kills and suicides if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - G_AddCreditToClient( attacker->client, -1, qtrue ); + G_AddCreditToClient( attacker->client, -ALIEN_TK_SUICIDE_PENALTY, qtrue ); else if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - G_AddCreditToClient( attacker->client, -ASPAWN_VALUE, qtrue ); + G_AddCreditToClient( attacker->client, -HUMAN_TK_SUICIDE_PENALTY, qtrue ); } else { @@ -237,109 +237,27 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int trap_Cvar_Set( "g_humanKills", va( "%d", g_humanKills.integer + 1 ) ); } + // distribute rewards for the kill by fraction of damage dealt if( totalDamage > 0.0f ) { - if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - { - //nice simple happy bouncy human land - float classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] ); - - for( i = 0; i < MAX_CLIENTS; i++ ) - { - player = g_entities + i; - - if( !player->client ) - continue; + float value = BG_GetValueOfPlayer( &self->client->ps ); - if( player->client->ps.stats[ STAT_PTEAM ] != PTE_HUMANS ) - continue; - - if( !self->credits[ i ] ) - continue; - - //add credit - G_AddCreditToClient( player->client, - (int)( classValue * ( (float)self->credits[ i ] / totalDamage ) ), qtrue ); - } - } - else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + for( i = 0; i < MAX_CLIENTS; i++ ) { - //horribly complex nasty alien land - float humanValue = BG_GetValueOfHuman( &self->client->ps ); - int frags; - int unclaimedFrags = (int)humanValue; - - for( i = 0; i < MAX_CLIENTS; i++ ) - { - player = g_entities + i; - - if( !player->client ) - continue; + player = g_entities + i; - if( player->client->ps.stats[ STAT_PTEAM ] != PTE_ALIENS ) - continue; - - //this client did no damage - if( !self->credits[ i ] ) - continue; - - //nothing left to claim - if( !unclaimedFrags ) - break; - - frags = (int)floor( humanValue * ( (float)self->credits[ i ] / totalDamage ) ); - - if( frags > 0 ) - { - //add kills - G_AddCreditToClient( player->client, frags, qtrue ); - - //can't revist this account later - self->credits[ i ] = 0; + if( !player->client ) + continue; - //reduce frags left to be claimed - unclaimedFrags -= frags; - } - } + if( player->client->ps.stats[ STAT_PTEAM ] == + self->client->ps.stats[ STAT_PTEAM ] ) + continue; - //there are frags still to be claimed - if( unclaimedFrags ) - { - //the clients remaining at this point do not - //have enough credit to claim even one frag - //so simply give the top clients - //a frag each + if( !self->credits[ i ] ) + continue; - for( i = 0; i < unclaimedFrags; i++ ) - { - int maximum = 0; - int topClient = 0; - - for( j = 0; j < MAX_CLIENTS; j++ ) - { - //this client did no damage - if( !self->credits[ j ] ) - continue; - - if( self->credits[ j ] > maximum ) - { - maximum = self->credits[ j ]; - topClient = j; - } - } - - if( maximum > 0 ) - { - player = g_entities + topClient; - - //add kills - G_AddCreditToClient( player->client, 1, qtrue ); - - //can't revist this account again - self->credits[ topClient ] = 0; - } - } - } + G_AddCreditToClient( player->client, + value * self->credits[ i ] / totalDamage, qtrue ); } } diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 52624862..1e02b74b 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -43,7 +43,7 @@ void G_ForceWeaponChange( gentity_t *ent, weapon_t weapon ) ent->client->ps.pm_flags |= PMF_WEAPON_SWITCH; if( weapon == WP_NONE || - !BG_InventoryContainsWeapon( weapon, ent->client->ps.stats )) + !BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) { //switch to the first non blaster weapon for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) diff --git a/src/game/tremulous.h b/src/game/tremulous.h index f944b46a..8d7ec89c 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -353,6 +353,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define ALIEN_REGEN_DAMAGE_TIME 2000 //msec since damage that regen starts again #define ALIEN_REGEN_NOCREEP_TIME 3000 //msec between regen off creep +#define ALIEN_MAX_FRAGS 9 +#define ALIEN_CREDITS_PER_FRAG 400 +#define ALIEN_TK_SUICIDE_PENALTY 350 + /* * HUMAN weapons * @@ -636,6 +640,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define HUMAN_SPAWN_REPEAT_TIME 10000 #define HUMAN_REGEN_DAMAGE_TIME 2000 //msec since damage before dcc repairs +#define HUMAN_MAX_CREDITS 2000 +#define HUMAN_TK_SUICIDE_PENALTY 150 + /* * Misc */ @@ -644,13 +651,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_FALL_DISTANCE 120.0f //the fall distance at which maximum damage is dealt #define AVG_FALL_DISTANCE ((MIN_FALL_DISTANCE+MAX_FALL_DISTANCE)/2.0f) -#define HUMAN_MAXED 900 //a human with a strong selection of weapons/upgrades -#define HUMAN_MAX_CREDITS 2000 -#define ALIEN_MAX_KILLS 9 -#define ALIEN_MAX_SINGLE_KILLS 3 - #define FREEKILL_PERIOD 120000 //msec -#define FREEKILL_ALIEN 1 +#define FREEKILL_ALIEN ALIEN_CREDITS_PER_FRAG #define FREEKILL_HUMAN LEVEL0_VALUE #define DEFAULT_ALIEN_BUILDPOINTS "100" diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 05a2ae07..23005600 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1424,6 +1424,38 @@ void UI_Load( void ) } +/* +=============== +UI_GetCurrentAlienStage +=============== +*/ +static stage_t UI_GetCurrentAlienStage( void ) +{ + char buffer[ MAX_TOKEN_CHARS ]; + stage_t stage, dummy; + + trap_Cvar_VariableStringBuffer( "ui_stages", buffer, sizeof( buffer ) ); + sscanf( buffer, "%d %d", ( int * ) & stage , ( int * ) & dummy ); + + return stage; +} + +/* +=============== +UI_GetCurrentHumanStage +=============== +*/ +static stage_t UI_GetCurrentHumanStage( void ) +{ + char buffer[ MAX_TOKEN_CHARS ]; + stage_t stage, dummy; + + trap_Cvar_VariableStringBuffer( "ui_stages", buffer, sizeof( buffer ) ); + sscanf( buffer, "%d %d", ( int * ) & dummy, ( int * ) & stage ); + + return stage; +} + /* =============== UI_DrawInfoPane @@ -1450,7 +1482,9 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl break; case INFOTYPE_CLASS: - value = BG_ClassCanEvolveFromTo( class, item->v.pclass, credits, 0 ); + value = ( BG_ClassCanEvolveFromTo( class, item->v.pclass, credits, + UI_GetCurrentAlienStage(), 0 ) + + ALIEN_CREDITS_PER_FRAG - 1 ) / ALIEN_CREDITS_PER_FRAG; if( value < 1 ) { @@ -1460,7 +1494,7 @@ static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, fl } else { - s = va( "%s\n\n%s\n\nKills: %d", + s = va( "%s\n\n%s\n\nFrags: %d", BG_FindHumanNameForClassNum( item->v.pclass ), BG_FindInfoForClassNum( item->v.pclass ), value ); @@ -2016,39 +2050,6 @@ void UI_ServersSort( int column, qboolean force ) sizeof( int ), UI_ServersQsortCompare ); } - -/* -=============== -UI_GetCurrentAlienStage -=============== -*/ -static stage_t UI_GetCurrentAlienStage( void ) -{ - char buffer[ MAX_TOKEN_CHARS ]; - stage_t stage, dummy; - - trap_Cvar_VariableStringBuffer( "ui_stages", buffer, sizeof( buffer ) ); - sscanf( buffer, "%d %d", ( int * ) & stage , ( int * ) & dummy ); - - return stage; -} - -/* -=============== -UI_GetCurrentHumanStage -=============== -*/ -static stage_t UI_GetCurrentHumanStage( void ) -{ - char buffer[ MAX_TOKEN_CHARS ]; - stage_t stage, dummy; - - trap_Cvar_VariableStringBuffer( "ui_stages", buffer, sizeof( buffer ) ); - sscanf( buffer, "%d %d", ( int * ) & dummy, ( int * ) & stage ); - - return stage; -} - /* =============== UI_LoadTeams @@ -2380,9 +2381,7 @@ static void UI_LoadAlienUpgrades( void ) for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) { - if( BG_ClassCanEvolveFromTo( class, i, credits, 0 ) >= 0 && - BG_FindStagesForClass( i, stage ) && - BG_ClassIsAllowed( i ) ) + if( BG_ClassCanEvolveFromTo( class, i, credits, stage, 0 ) >= 0 ) { uiInfo.alienUpgradeList[ j ].text = String_Alloc( BG_FindHumanNameForClassNum( i ) ); uiInfo.alienUpgradeList[ j ].cmd = diff --git a/ui/ingame_options.menu b/ui/ingame_options.menu index f80c311c..00390713 100644 --- a/ui/ingame_options.menu +++ b/ui/ingame_options.menu @@ -634,8 +634,8 @@ name move group optionsGrp type ITEM_TYPE_BIND - text "Sprint:" - cvar "boost" + text "Sprint / Dodge:" + cvar "+button6" rect SCONTENT_X (SCONTENT_Y+(2*ELEM_H)) SCONTENT_W ELEM_H textalign ALIGN_RIGHT textvalign VALIGN_CENTER -- cgit