From 068a622220beae63c715f69bb91165aa26136b6b Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 31 May 2017 22:16:09 +0200 Subject: Add the clusterfuck mode. --- src/game/g_cmds.c | 57 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 13 deletions(-) (limited to 'src/game/g_cmds.c') diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index bcd51de..2c13fd4 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -3080,6 +3080,9 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->client->pers.teamSelection == PTE_ALIENS ) { + if( g_clusterfuck.integer ) + goto just_spawn_alien; + if( newClass != PCL_ALIEN_BUILDER0 && newClass != PCL_ALIEN_BUILDER0_UPG && newClass != PCL_ALIEN_LEVEL0 ) @@ -3110,6 +3113,7 @@ void Cmd_Class_f( gentity_t *ent ) return; } + just_spawn_alien: // spawn from an egg if( G_PushSpawnQueue( &level.alienSpawnQueue, clientNum ) ) { @@ -3117,31 +3121,40 @@ void Cmd_Class_f( gentity_t *ent ) ent->client->ps.stats[ STAT_PCLASS ] = newClass; } } + + else if( ent->client->pers.teamSelection == PTE_HUMANS ) { + int weapon; + + weapon = BG_FindWeaponNumForName( s ); + + if( g_clusterfuck.integer && weapon != WP_NONE) + { + ent->client->pers.humanItemSelection = weapon; + goto just_spawn_human; + } + //set the item to spawn with - if( !Q_stricmp( s, BG_FindNameForWeapon( WP_MACHINEGUN ) ) && - BG_WeaponIsAllowed( WP_MACHINEGUN ) ) + if( weapon == WP_MACHINEGUN && BG_WeaponIsAllowed( WP_MACHINEGUN ) ) { ent->client->pers.humanItemSelection = WP_MACHINEGUN; } - else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD ) ) && - BG_WeaponIsAllowed( WP_HBUILD ) ) + else if( weapon == WP_HBUILD && BG_WeaponIsAllowed( WP_HBUILD ) ) { ent->client->pers.humanItemSelection = WP_HBUILD; } - else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD2 ) ) && - BG_WeaponIsAllowed( WP_HBUILD2 ) && + else if( weapon == WP_HBUILD2 && BG_WeaponIsAllowed( WP_HBUILD2 ) && BG_FindStagesForWeapon( WP_HBUILD2, g_humanStage.integer ) ) { ent->client->pers.humanItemSelection = WP_HBUILD2; } else { - trap_SendServerCommand( ent-g_entities, - "print \"Unknown starting item\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Unknown starting item\n\"" ); return; } + just_spawn_human: // spawn from a telenode G_LogOnlyPrintf("ClientTeamClass: %i human %s\n", clientNum, s); if( G_PushSpawnQueue( &level.humanSpawnQueue, clientNum ) ) @@ -3177,6 +3190,9 @@ void Cmd_Class_f( gentity_t *ent ) return; } + if( g_clusterfuck.integer ) + goto just_evolve; + //check there are no humans nearby VectorAdd( ent->client->ps.origin, range, maxs ); VectorSubtract( ent->client->ps.origin, range, mins ); @@ -3230,6 +3246,7 @@ void Cmd_Class_f( gentity_t *ent ) BG_FindStagesForClass( newClass, g_alienStage.integer ) && BG_ClassIsAllowed( newClass ) ) { + just_evolve: G_LogOnlyPrintf("ClientTeamClass: %i alien %s\n", clientNum, s); ent->client->pers.evolveHealthFraction = (float)ent->client->ps.stats[ STAT_HEALTH ] / @@ -3398,10 +3415,12 @@ void Cmd_Destroy_f( gentity_t *ent ) if( tr.fraction < 1.0f && ( traceEnt->s.eType == ET_BUILDABLE ) && - ( traceEnt->biteam == ent->client->pers.teamSelection ) && + ( g_clusterfuck.integer || traceEnt->biteam == ent->client->pers.teamSelection ) && ( ( ent->client->ps.weapon >= WP_ABUILD ) && ( ent->client->ps.weapon <= WP_HBUILD ) ) ) { + if( g_clusterfuck.integer ) + goto just_decon; // Cancel deconstruction if( g_markDeconstruct.integer == 1 && traceEnt->deconstruct ) { @@ -3469,6 +3488,7 @@ void Cmd_Destroy_f( gentity_t *ent ) } else { + just_decon: if( traceEnt->health > 0 ) { buildHistory_t *new; @@ -3819,6 +3839,13 @@ void Cmd_Buy_f( gentity_t *ent ) buyingEnergyAmmo = hasEnergyWeapon; } + if( g_clusterfuck.integer ) { + if ( weapon != WP_NONE ) + goto just_buy_weapon; + else + goto just_buy_upgrade; + } + if( buyingEnergyAmmo ) { //no armoury nearby @@ -3892,7 +3919,7 @@ void Cmd_Buy_f( gentity_t *ent ) trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy this item\n\"" ) ); return; } - + just_buy_weapon: //add to inventory BG_AddWeaponToInventory( weapon, ent->client->ps.stats ); BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); @@ -3970,7 +3997,7 @@ void Cmd_Buy_f( gentity_t *ent ) va( "print \"You can't buy this item while crouching\n\"" ) ); return; } - + just_buy_upgrade: if( upgrade == UP_AMMO ) G_GiveClientMaxAmmo( ent, buyingEnergyAmmo ); else @@ -4018,7 +4045,7 @@ void Cmd_Sell_f( gentity_t *ent ) trap_Argv( 1, s, sizeof( s ) ); //no armoury nearby - if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) + if( !g_clusterfuck.integer && !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) { trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); return; @@ -5473,6 +5500,7 @@ void ClientCommand( int clientNum ) return; } + // do tests here to reduce the amount of repeated code if( !( cmds[ i ].cmdFlags & CMD_INTERMISSION ) && ( level.intermissiontime || level.paused ) ) @@ -5492,6 +5520,9 @@ void ClientCommand( int clientNum ) return; } + if( g_clusterfuck.integer ) + goto just_execute; + if( cmds[ i ].cmdFlags & CMD_TEAM && ent->client->pers.teamSelection == PTE_NONE ) { @@ -5531,7 +5562,7 @@ void ClientCommand( int clientNum ) "print \"Must be living to use this command\n\"" ); return; } - +just_execute: // Disallow a large class of commands if a player is restricted. if( G_admin_is_restricted( ent, qtrue ) && ( !Q_stricmp( cmd, "team" ) || -- cgit