diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 2 | ||||
-rw-r--r-- | src/game/g_buildable.c | 8 | ||||
-rw-r--r-- | src/game/g_cmds.c | 95 | ||||
-rw-r--r-- | src/game/g_main.c | 22 | ||||
-rw-r--r-- | src/game/tremulous.h | 2 |
5 files changed, 74 insertions, 55 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index bd3db376..9922bf13 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1518,7 +1518,7 @@ classAttributes_t bg_classList[ ] = 1.0f, //float airAcceleration; 6.0f, //float friction; 100.0f, //float stopSpeed; - 130.0f, //float jumpMagnitude; + 195.0f, //float jumpMagnitude; 1.0f, //float knockbackScale; { PCL_ALIEN_BUILDER0_UPG, PCL_ALIEN_LEVEL0, PCL_NONE }, //int children[ 3 ]; ABUILDER_COST, //int cost; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index c9079f39..a33a209e 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2405,7 +2405,13 @@ qboolean G_BuildableRange( vec3_t origin, float r, buildable_t buildable ) { ent = &g_entities[ entityList[ i ] ]; - if( ent->s.eType == ET_BUILDABLE && ent->s.modelindex == buildable && ent->spawned ) + if( ent->s.eType != ET_BUILDABLE ) + continue; + + if( ent->biteam == BIT_HUMANS && !ent->powered ) + continue; + + if( ent->s.modelindex == buildable && ent->spawned ) return qtrue; } diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 421fb9d5..42273bc0 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -198,13 +198,13 @@ qboolean CheatsOk( gentity_t *ent ) { if( !g_cheats.integer ) { - trap_SendServerCommand( ent-g_entities, va( "print \"Cheats are not enabled on this server.\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) ); return qfalse; } if( ent->health <= 0 ) { - trap_SendServerCommand( ent-g_entities, va( "print \"You must be alive to use this command.\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"You must be alive to use this command\n\"" ) ); return qfalse; } @@ -446,12 +446,12 @@ void Cmd_Kill_f( gentity_t *ent ) { if( ent->suicideTime == 0 ) { - trap_SendServerCommand( ent-g_entities, "print \"You will suicide in 20 seconds.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"You will suicide in 20 seconds\n\"" ); ent->suicideTime = level.time + 20000; } else if( ent->suicideTime > level.time ) { - trap_SendServerCommand( ent-g_entities, "print \"Suicide cancelled.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Suicide cancelled\n\"" ); ent->suicideTime = 0; } } @@ -546,9 +546,9 @@ void Cmd_Team_f( gentity_t *ent ) G_ChangeTeam( ent, team ); if( team == PTE_ALIENS ) - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens.\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) ); else if( team == PTE_HUMANS ) - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans.\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", ent->client->pers.netname ) ); } @@ -724,25 +724,25 @@ void Cmd_CallVote_f( gentity_t *ent ) if( !g_allowVote.integer ) { - trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here\n\"" ); return; } if( level.voteTime ) { - trap_SendServerCommand( ent-g_entities, "print \"A vote is already in progress.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"A vote is already in progress\n\"" ); return; } if( ent->client->pers.voteCount >= MAX_VOTE_COUNT ) { - trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes\n\"" ); return; } if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) { - trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" ); return; } @@ -752,7 +752,7 @@ void Cmd_CallVote_f( gentity_t *ent ) if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) { - trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); return; } @@ -764,10 +764,10 @@ void Cmd_CallVote_f( gentity_t *ent ) else if( !Q_stricmp( arg1, "timelimit" ) ) { } else { - trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map <mapname>, " "kick <player>, clientkick <clientnum>, " - "timelimit <time>.\n\"" ); + "timelimit <time>\n\"" ); return; } @@ -801,7 +801,7 @@ void Cmd_CallVote_f( gentity_t *ent ) if( !*s ) { - trap_SendServerCommand( ent-g_entities, "print \"nextmap not set.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"nextmap not set\n\"" ); return; } @@ -814,7 +814,7 @@ void Cmd_CallVote_f( gentity_t *ent ) Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString ); } - trap_SendServerCommand( -1, va( "print \"%s called a vote.\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( -1, va( "print \"%s called a vote\n\"", ent->client->pers.netname ) ); // start the voting, the caller autoamtically votes yes level.voteTime = level.time; @@ -843,23 +843,23 @@ void Cmd_Vote_f( gentity_t *ent ) if( !level.voteTime ) { - trap_SendServerCommand( ent-g_entities, "print \"No vote in progress.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"No vote in progress\n\"" ); return; } if( ent->client->ps.eFlags & EF_VOTED ) { - trap_SendServerCommand( ent-g_entities, "print \"Vote already cast.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Vote already cast\n\"" ); return; } if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) { - trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" ); return; } - trap_SendServerCommand( ent-g_entities, "print \"Vote cast.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Vote cast\n\"" ); ent->client->ps.eFlags |= EF_VOTED; @@ -902,25 +902,25 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) if( !g_allowVote.integer ) { - trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here\n\"" ); return; } if( level.teamVoteTime[ cs_offset ] ) { - trap_SendServerCommand( ent-g_entities, "print \"A team vote is already in progress.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"A team vote is already in progress\n\"" ); return; } if( ent->client->pers.teamVoteCount >= MAX_VOTE_COUNT ) { - trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of team votes.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of team votes\n\"" ); return; } if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) { - trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" ); return; } @@ -930,7 +930,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) { - trap_SendServerCommand( ent-g_entities, "print \"Invalid team vote string.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Invalid team vote string\n\"" ); return; } @@ -958,14 +958,14 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) if( i >= level.maxclients ) { - trap_SendServerCommand( ent-g_entities, va( "print \"%s is not a valid player on your team.\n\"", arg2 ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"%s is not a valid player on your team\n\"", arg2 ) ); return; } } else { - trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" ); - trap_SendServerCommand( ent-g_entities, "print \"Team vote commands are: teamkick <player>.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Team vote commands are: teamkick <player>\n\"" ); return; } @@ -978,7 +978,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) continue; if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team ) - trap_SendServerCommand( i, va("print \"%s called a team vote.\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( i, va("print \"%s called a team vote\n\"", ent->client->pers.netname ) ); } // start the voting, the caller autoamtically votes yes @@ -1021,23 +1021,23 @@ void Cmd_TeamVote_f( gentity_t *ent ) if( !level.teamVoteTime[ cs_offset ] ) { - trap_SendServerCommand( ent-g_entities, "print \"No team vote in progress.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"No team vote in progress\n\"" ); return; } if( ent->client->ps.eFlags & EF_TEAMVOTED ) { - trap_SendServerCommand( ent-g_entities, "print \"Team vote already cast.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Team vote already cast\n\"" ); return; } if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE ) { - trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" ); return; } - trap_SendServerCommand( ent-g_entities, "print \"Team vote cast.\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Team vote cast\n\"" ); ent->client->ps.eFlags |= EF_TEAMVOTED; @@ -1072,7 +1072,7 @@ void Cmd_SetViewpos_f( gentity_t *ent ) if( !g_cheats.integer ) { - trap_SendServerCommand( ent-g_entities, va( "print \"Cheats are not enabled on this server.\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) ); return; } @@ -1113,6 +1113,7 @@ void Cmd_Class_f( gentity_t *ent ) vec3_t infestOrigin; int allowedClasses[ PCL_NUM_CLASSES ]; int numClasses = 0; + pClass_t currentClass = ent->client->ps.stats[ STAT_PCLASS ]; int numLevels; vec3_t fromMins, fromMaxs, toMins, toMaxs; @@ -1148,7 +1149,7 @@ void Cmd_Class_f( gentity_t *ent ) !( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) { //if we are not currently spectating, we are attempting evolution - if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE ) + if( currentClass != PCL_NONE ) { //check there are no humans nearby VectorAdd( ent->client->ps.origin, range, maxs ); @@ -1175,6 +1176,15 @@ void Cmd_Class_f( gentity_t *ent ) return; } + //guard against selling the HBUILD weapons exploit + if( ( currentClass == PCL_ALIEN_BUILDER0 || + currentClass == PCL_ALIEN_BUILDER0_UPG ) && + ent->client->ps.stats[ STAT_MISC ] > 0 ) + { + trap_SendServerCommand( ent-g_entities, va( "print \"Cannot evolve until build timer expires\n\"" ) ); + return; + } + //evolve now ent->client->pers.classSelection = BG_FindClassNumForName( s ); @@ -1184,11 +1194,11 @@ void Cmd_Class_f( gentity_t *ent ) return; } - numLevels = BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], + numLevels = BG_ClassCanEvolveFromTo( currentClass, ent->client->pers.classSelection, (short)ent->client->ps.persistant[ PERS_CREDIT ], 0 ); - BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], + BG_FindBBoxForClass( currentClass, fromMins, fromMaxs, NULL, NULL, NULL ); BG_FindBBoxForClass( ent->client->pers.classSelection, toMins, toMaxs, NULL, NULL, NULL ); @@ -1285,6 +1295,9 @@ void Cmd_Class_f( gentity_t *ent ) ent->client->pers.humanItemSelection = WP_MACHINEGUN; else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD ) ) ) ent->client->pers.humanItemSelection = WP_HBUILD; + else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD2 ) ) && + BG_FindStagesForWeapon( WP_HBUILD2, g_humanStage.integer ) ) + ent->client->pers.humanItemSelection = WP_HBUILD2; else { ent->client->pers.classSelection = PCL_NONE; @@ -1573,7 +1586,7 @@ void Cmd_Buy_f( gentity_t *ent ) //no armoury nearby if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) && !buyingEnergyAmmo ) { - trap_SendServerCommand( ent-g_entities, va( "print \"You must be near an armoury\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); return; } @@ -1758,7 +1771,7 @@ void Cmd_Sell_f( gentity_t *ent ) //no armoury nearby if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) { - trap_SendServerCommand( ent-g_entities, va( "print \"You must be near an armoury\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); return; } @@ -1770,7 +1783,7 @@ void Cmd_Sell_f( gentity_t *ent ) //are we /allowed/ to sell this? if( !BG_FindPurchasableForWeapon( weapon ) ) { - trap_SendServerCommand( ent-g_entities, va( "print \"You can't sell this weapon.\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"You can't sell this weapon\n\"" ) ); return; } @@ -1781,7 +1794,7 @@ void Cmd_Sell_f( gentity_t *ent ) if( ( weapon == WP_HBUILD || weapon == WP_HBUILD2 ) && ent->client->ps.stats[ STAT_MISC ] > 0 ) { - trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires.\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) ); return; } @@ -1838,7 +1851,7 @@ void Cmd_Sell_f( gentity_t *ent ) if( ( i == WP_HBUILD || i == WP_HBUILD2 ) && ent->client->ps.stats[ STAT_MISC ] > 0 ) { - trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires.\n\"" ) ); + trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) ); continue; } diff --git a/src/game/g_main.c b/src/game/g_main.c index badacdb4..14ec7d58 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -493,7 +493,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) } } else - G_Printf( "Not logging to disk.\n" ); + G_Printf( "Not logging to disk\n" ); // initialize all entities for this game memset( g_entities, 0, MAX_GENTITIES * sizeof( g_entities[ 0 ] ) ); @@ -1600,7 +1600,7 @@ void CheckExitRules( void ) { if( level.time - level.startTime >= g_timelimit.integer * 60000 ) { - trap_SendServerCommand( -1, "print \"Timelimit hit.\n\"" ); + trap_SendServerCommand( -1, "print \"Timelimit hit\n\"" ); G_LogPrintf( "STATS T:L A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients, level.averageNumHumanClients, s, level.time - level.startTime ); @@ -1616,7 +1616,7 @@ void CheckExitRules( void ) { //humans win level.lastWin = PTE_HUMANS; - trap_SendServerCommand( -1, "print \"Humans win.\n\""); + trap_SendServerCommand( -1, "print \"Humans win\n\""); G_LogPrintf( "STATS T:H A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients, level.averageNumHumanClients, s, level.time - level.startTime ); @@ -1630,7 +1630,7 @@ void CheckExitRules( void ) { //aliens win level.lastWin = PTE_ALIENS; - trap_SendServerCommand( -1, "print \"Aliens win.\n\""); + trap_SendServerCommand( -1, "print \"Aliens win\n\""); G_LogPrintf( "STATS T:A A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients, level.averageNumHumanClients, s, level.time - level.startTime ); @@ -1680,13 +1680,13 @@ void CheckVote( void ) if( level.voteYes > level.voteNo ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, "print \"Vote passed.\n\"" ); + trap_SendServerCommand( -1, "print \"Vote passed\n\"" ); level.voteExecuteTime = level.time + 3000; } else { // same behavior as a timeout - trap_SendServerCommand( -1, "print \"Vote failed.\n\"" ); + trap_SendServerCommand( -1, "print \"Vote failed\n\"" ); } } else @@ -1694,13 +1694,13 @@ void CheckVote( void ) if( level.voteYes > level.numConnectedClients / 2 ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, "print \"Vote passed.\n\"" ); + trap_SendServerCommand( -1, "print \"Vote passed\n\"" ); level.voteExecuteTime = level.time + 3000; } else if( level.voteNo >= level.numConnectedClients / 2 ) { // same behavior as a timeout - trap_SendServerCommand( -1, "print \"Vote failed.\n\"" ); + trap_SendServerCommand( -1, "print \"Vote failed\n\"" ); } else { @@ -1735,21 +1735,21 @@ void CheckTeamVote( int team ) if( level.time - level.teamVoteTime[ cs_offset ] >= VOTE_TIME ) { - trap_SendServerCommand( -1, "print \"Team vote failed.\n\"" ); + trap_SendServerCommand( -1, "print \"Team vote failed\n\"" ); } else { if( level.teamVoteYes[ cs_offset ] > level.numteamVotingClients[ cs_offset ] / 2 ) { // execute the command, then remove the vote - trap_SendServerCommand( -1, "print \"Team vote passed.\n\"" ); + trap_SendServerCommand( -1, "print \"Team vote passed\n\"" ); // trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) ); } else if( level.teamVoteNo[ cs_offset ] >= level.numteamVotingClients[ cs_offset ] / 2 ) { // same behavior as a timeout - trap_SendServerCommand( -1, "print \"Team vote failed.\n\"" ); + trap_SendServerCommand( -1, "print \"Team vote failed\n\"" ); } else { diff --git a/src/game/tremulous.h b/src/game/tremulous.h index d82b64aa..741525c7 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -402,7 +402,7 @@ #define HBUILD_DELAY 17500 #define HBUILD_HEALRATE 18 -#define HBUILD2_PRICE 75 +#define HBUILD2_PRICE 0 #define HBUILD2_REPEAT 1000 #define HBUILD2_DELAY 15000 |