diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_pmove.c | 8 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_active.c | 31 | ||||
-rw-r--r-- | src/game/g_client.c | 12 | ||||
-rw-r--r-- | src/game/g_cmds.c | 39 | ||||
-rw-r--r-- | src/game/g_local.h | 3 |
6 files changed, 83 insertions, 13 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index bffc47fc..6787e250 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -422,7 +422,7 @@ static float PM_CmdScale( usercmd_t *cmd ) { aForward = abs( cmd->forwardmove ); aRight = abs( cmd->rightmove ); - if( ( aForward <= 64 && aForward > 5 ) && ( aRight <= 64 && aRight > 5 ) ) + if( ( aForward <= 64 && aForward > 5 ) || ( aRight <= 64 && aRight > 5 ) ) { //restore stamina pm->ps->stats[ STAT_STAMINA ] += (dTime/5); @@ -1550,6 +1550,9 @@ static void PM_GroundClimbTrace( void ) if( abc[ 2 ] == 0 ) correction = 0; + if( correction > 32768 ) + correction -= 32768; + //phew! - correct the angle pm->ps->delta_angles[ YAW ] -= correction; } @@ -2229,7 +2232,6 @@ static void PM_Weapon( void ) { pm->ps->pm_flags &= ~PMF_USE_ITEM_HELD; }*/ - // make weapon function if ( pm->ps->weaponTime > 0 ) { pm->ps->weaponTime -= pml.msec; @@ -2397,7 +2399,7 @@ static void PM_Weapon( void ) { addTime = 800; break; case WP_FLAMER: - addTime = 80; + addTime = 150; break; case WP_RAILGUN: addTime = 1500; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ad113b31..a4e6ea46 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -506,7 +506,8 @@ typedef enum MN_DROID, MN_HUMAN, MN_ABUILD, - MN_HBUILD + MN_HBUILD, + MN_MCU } dynMenu_t; // animations diff --git a/src/game/g_active.c b/src/game/g_active.c index b6c7d41b..e4a1ffbf 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -356,7 +356,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) { client->oldbuttons = client->buttons; client->buttons = ucmd->buttons; - if ( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) ) + if( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) ) { if( client->pers.pteam == PTE_NONE ) { @@ -371,13 +371,13 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) { G_AddPredictableEvent( ent, EV_MENU, MN_HUMAN ); } } - + // attack button cycles through spectators //TA: messes with the menus - /*if ( ( client->buttons & BUTTON_ATTACK ) && + if ( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) && - ( client->sess.spectatorState != SPECTATOR_LOCKED ) ) - Cmd_FollowCycle_f( ent, 1 );*/ + ( client->sess.spectatorState == SPECTATOR_FREE ) ) + Cmd_FollowCycle_f( ent, 1 ); } @@ -882,6 +882,27 @@ void ClientThink_real( gentity_t *ent ) { client->buttons = ucmd->buttons; client->latched_buttons |= client->buttons & ~client->oldbuttons; + //TA: look for MCU infront of player + if( ( client->buttons & BUTTON_GETFLAG ) && !( client->oldbuttons & BUTTON_GETFLAG ) ) + { + if( client->pers.pteam == PTE_HUMANS ) + { + trace_t mcu; + vec3_t view, point; + gentity_t *mcuEntity; + + AngleVectors( client->ps.viewangles, view, NULL, NULL ); + VectorMA( client->ps.origin, 200, view, point ); + trap_Trace( &mcu, client->ps.origin, NULL, NULL, point, ent->s.number, MASK_SHOT ); + + mcuEntity = &g_entities[ mcu.entityNum ]; + + //bring up a menu if its there + if( !Q_stricmp( mcuEntity->classname, "team_human_mcu" ) ) + G_AddPredictableEvent( ent, EV_MENU, MN_MCU ); + } + } + // check for respawning if ( client->ps.stats[STAT_HEALTH] <= 0 ) { // wait for the attack button to be pressed diff --git a/src/game/g_client.c b/src/game/g_client.c index 422ebc84..49868661 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1356,8 +1356,16 @@ void ClientSpawn(gentity_t *ent) { client->ps.clientNum = index; - /*BG_packWeapon( WP_MACHINEGUN, client->ps.stats ); - BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, CS_MG, 4, 4 );*/ + if( client->pers.pitem == WP_MACHINEGUN ) + { + BG_packWeapon( WP_MACHINEGUN, client->ps.stats ); + BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, CS_MG, 4, 4 ); + } + else if( client->pers.pitem == WP_HBUILD ) + { + BG_packWeapon( WP_HBUILD, client->ps.stats ); + BG_packAmmoArray( WP_HBUILD, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + } client->ps.stats[ STAT_ABILITIES ] |= SCA_TAKESFALLDAMAGE; client->ps.stats[ STAT_ABILITIES ] |= SCA_CANJUMP; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 104ec02b..09884232 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1556,6 +1556,12 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->client->pers.pteam == PTE_DROIDS ) { + if( ent->client->pers.pclass != 0 ) + { + trap_SendServerCommand( ent-g_entities, va("print \"You must be dead to use the class command\n\"" ) ); + return; + } + if( !Q_stricmp(s, "0") ) ent->client->pers.pclass = PCL_D_BUILDER; else if( !Q_stricmp(s, "1") ) @@ -1594,8 +1600,19 @@ void Cmd_Class_f( gentity_t *ent ) } else if( ent->client->pers.pteam == PTE_HUMANS ) { + if( ent->client->pers.pclass != 0 ) + { + trap_SendServerCommand( ent-g_entities, va("print \"You must be dead to use the class command\n\"" ) ); + return; + } + ent->client->pers.pclass = PCL_H_BASE; + if( !Q_stricmp( s, "0" ) ) + ent->client->pers.pitem = WP_MACHINEGUN; + else if( !Q_stricmp( s, "1" ) ) + ent->client->pers.pitem = WP_HBUILD; + if( ent->client->torch != NULL ) Cmd_TorchOff_f( ent ); @@ -1758,10 +1775,30 @@ Cmd_Buy_f */ void Cmd_Buy_f( gentity_t *ent ) { - char s[ MAX_TOKEN_CHARS ]; + char s[ MAX_TOKEN_CHARS ]; + vec3_t distance; + int i; + gentity_t *mcuEntity; + qboolean nearMCU = qfalse; trap_Argv( 1, s, sizeof( s ) ); + for ( i = 1, mcuEntity = g_entities + i; i < level.num_entities; i++, mcuEntity++ ) + { + if( !Q_stricmp( mcuEntity->classname, "team_human_mcu" ) ) + { + VectorSubtract( ent->s.pos.trBase, mcuEntity->s.origin, distance ); + if( VectorLength( distance ) <= 100 ) + nearMCU = qtrue; + } + } + + if( !nearMCU ) + { + trap_SendServerCommand( ent-g_entities, va("print \"You must be near an MCU\n\"" ) ); + return; + } + if( ent->client->pers.pteam != PTE_HUMANS ) return; diff --git a/src/game/g_local.h b/src/game/g_local.h index 81ed6966..54d73c90 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -258,7 +258,8 @@ typedef struct { int pclass; //TA: player class (copied to ent->client->ps.stats[ STAT_PCLASS ] once spawned) //not really persistant.. this is just a nice place to stick it :) - int pteam; //TA: player team (team deathmatch is too complex to alter) (copied to ps.stats[ STAT_PTEAM ]) + int pitem; //TA: humans have a starting item + int pteam; //TA: player team (copied to ps.stats[ STAT_PTEAM ]) } clientPersistant_t; // this structure is cleared on each ClientSpawn(), |