summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/bg_misc.c2
-rw-r--r--src/game/g_active.c12
-rw-r--r--src/game/g_buildable.c73
-rw-r--r--src/game/g_local.h4
-rw-r--r--src/ui/ui_main.c34
5 files changed, 70 insertions, 55 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 69ff92e5..0386c42d 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -1484,7 +1484,7 @@ classAttributes_t bg_classList[ ] =
ABUILDER_UPG_REGEN, //int regenRate;
SCA_FOVWARPS|SCA_WALLCLIMBER|SCA_ALIENSENSE, //int abilities;
WP_ABUILD2, //weapon_t startWeapon
- 95.0f, //float buildDist;
+ 105.0f, //float buildDist;
110, //int fov;
0.001f, //float bob;
2.0f, //float bobCycle;
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 1ce30162..21ff144e 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1111,24 +1111,14 @@ void ClientThink_real( gentity_t *ent )
if( client->ps.stats[ STAT_STATE ] & SS_HOVELING )
{
gentity_t *hovel = client->hovel;
- vec3_t newOrigin, newAngles;
- vec3_t mins, maxs;
-
- BG_FindBBoxForClass( client->ps.stats[ STAT_PCLASS ], mins, maxs, NULL, NULL, NULL );
//only let the player out if there is room
- if( !AHovel_Blocked( hovel->s.angles, hovel->s.origin, hovel->s.origin2,
- mins, maxs, 0, newOrigin, newAngles ) )
+ if( !AHovel_Blocked( hovel, ent, qtrue ) )
{
//prevent lerping
client->ps.eFlags ^= EF_TELEPORT_BIT;
client->ps.eFlags &= ~EF_NODRAW;
- G_SetOrigin( ent, newOrigin );
- VectorCopy( newOrigin, client->ps.origin );
- VectorCopy( vec3_origin, client->ps.velocity );
- SetClientViewAngle( ent, newAngles );
-
//client leaves hovel
client->ps.stats[ STAT_STATE ] &= ~SS_HOVELING;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index c5478aff..02956095 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -857,57 +857,84 @@ void AHive_Think( gentity_t *self )
-#define HOVEL_TRACE_DEPTH 16.0f
+#define HOVEL_TRACE_DEPTH 128.0f
/*
================
AHovel_Blocked
-Is this hovel entrace blocked?
+Is this hovel entrance blocked?
================
*/
-qboolean AHovel_Blocked( vec3_t srcAngles, vec3_t srcOrigin, vec3_t normal,
- vec3_t mins, vec3_t maxs, int entityNum,
- vec3_t newOrigin, vec3_t newAngles )
+qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideExit )
{
- vec3_t forward, origin, start, end, angles, hovelMaxs;
+ vec3_t forward, normal, origin, start, end, angles, hovelMaxs;
+ vec3_t mins, maxs;
float displacement;
trace_t tr;
BG_FindBBoxForBuildable( BA_A_HOVEL, NULL, hovelMaxs );
+ BG_FindBBoxForClass( player->client->ps.stats[ STAT_PCLASS ],
+ mins, maxs, NULL, NULL, NULL );
- AngleVectors( srcAngles, forward, NULL, NULL );
+ VectorCopy( hovel->s.origin2, normal );
+ AngleVectors( hovel->s.angles, forward, NULL, NULL );
VectorInverse( forward );
- displacement = VectorMaxComponent( maxs ) + VectorMaxComponent( hovelMaxs ) + 1.0f;
+ displacement = VectorMaxComponent( maxs ) * M_ROOT3 +
+ VectorMaxComponent( hovelMaxs ) * M_ROOT3 + 1.0f;
- VectorMA( srcOrigin, displacement, forward, origin );
+ VectorMA( hovel->s.origin, displacement, forward, origin );
vectoangles( forward, angles );
VectorMA( origin, HOVEL_TRACE_DEPTH, normal, start );
+
+ //compute a place up in the air to start the real trace
+ trap_Trace( &tr, origin, mins, maxs, start, player->s.number, MASK_PLAYERSOLID );
+ VectorMA( origin, ( HOVEL_TRACE_DEPTH * tr.fraction ) - 1.0f, normal, start );
VectorMA( origin, -HOVEL_TRACE_DEPTH, normal, end );
- trap_Trace( &tr, start, mins, maxs, end, entityNum, MASK_PLAYERSOLID );
+ trap_Trace( &tr, start, mins, maxs, end, player->s.number, MASK_PLAYERSOLID );
if( tr.startsolid )
- return qfalse;
+ return qtrue;
VectorCopy( tr.endpos, origin );
- trap_Trace( &tr, origin, mins, maxs, origin, entityNum, MASK_PLAYERSOLID );
-
- if( newOrigin != NULL )
- VectorCopy( origin, newOrigin );
+ trap_Trace( &tr, origin, mins, maxs, origin, player->s.number, MASK_PLAYERSOLID );
- if( newAngles != NULL )
- VectorCopy( angles, newAngles );
+ if( provideExit )
+ {
+ G_SetOrigin( player, origin );
+ VectorCopy( origin, player->client->ps.origin );
+ VectorCopy( vec3_origin, player->client->ps.velocity );
+ SetClientViewAngle( player, angles );
+ }
- if( tr.fraction < 1.0 )
+ if( tr.fraction < 1.0f )
return qtrue;
else
return qfalse;
}
+/*
+================
+APropHovel_Blocked
+
+Wrapper to test a hovel placement for validity
+================
+*/
+static qboolean APropHovel_Blocked( vec3_t origin, vec3_t angles, vec3_t normal,
+ gentity_t *player )
+{
+ gentity_t hovel;
+
+ VectorCopy( origin, hovel.s.origin );
+ VectorCopy( angles, hovel.s.angles );
+ VectorCopy( normal, hovel.s.origin2 );
+
+ return AHovel_Use( &hovel, player, qfalse );
+}
/*
================
@@ -930,6 +957,13 @@ void AHovel_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
else if( ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_BASE ) ||
( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_LEV1 ) )
{
+ if( AHovel_Blocked( self, activator, qfalse ) )
+ {
+ //you can get in, but you can't get out
+ G_TriggerMenu( activator->client->ps.clientNum, MN_A_HOVEL_BLOCKED );
+ return;
+ }
+
self->active = qtrue;
G_setBuildableAnim( self, BANIM_ATTACK1, qfalse );
@@ -2020,8 +2054,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//this assumes the adv builder is the biggest thing that'll use the hovel
BG_FindBBoxForClass( PCL_A_B_LEV1, builderMins, builderMaxs, NULL, NULL, NULL );
- if( AHovel_Blocked( angles, origin, normal, builderMins, builderMaxs,
- ent->client->ps.clientNum, NULL, NULL ) )
+ if( APropHovel_Blocked( angles, origin, normal, ent ) )
reason = IBE_HOVELEXIT;
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index ad4044e2..64e4a83a 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -573,9 +573,7 @@ typedef enum
IBE_MAXERRORS
} itemBuildError_t;
-qboolean AHovel_Blocked( vec3_t srcAngles, vec3_t srcOrigin, vec3_t normal,
- vec3_t mins, vec3_t maxs, int entityNum,
- vec3_t newOrigin, vec3_t newAngles );
+qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideExit );
qboolean G_BuildableRange( vec3_t origin, float r, buildable_t buildable );
itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance, vec3_t origin );
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 15b43c67..502cf190 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -3320,15 +3320,15 @@ static void UI_LoadTremTeams( void )
{
uiInfo.tremTeamCount = 3;
uiInfo.tremTeamList[ 0 ].text = String_Alloc( "Aliens" );
- uiInfo.tremTeamList[ 0 ].cmd = String_Alloc( "cmd team aliens" );
+ uiInfo.tremTeamList[ 0 ].cmd = String_Alloc( "cmd team aliens\n" );
uiInfo.tremTeamList[ 0 ].infopane = UI_FindInfoPaneByName( "alienteam" );
uiInfo.tremTeamList[ 1 ].text = String_Alloc( "Humans" );
- uiInfo.tremTeamList[ 1 ].cmd = String_Alloc( "cmd team humans" );
+ uiInfo.tremTeamList[ 1 ].cmd = String_Alloc( "cmd team humans\n" );
uiInfo.tremTeamList[ 1 ].infopane = UI_FindInfoPaneByName( "humanteam" );
uiInfo.tremTeamList[ 2 ].text = String_Alloc( "Spectate" );
- uiInfo.tremTeamList[ 2 ].cmd = String_Alloc( "cmd team spectate" );
+ uiInfo.tremTeamList[ 2 ].cmd = String_Alloc( "cmd team spectate\n" );
uiInfo.tremTeamList[ 2 ].infopane = UI_FindInfoPaneByName( "spectateteam" );
}
@@ -3346,7 +3346,7 @@ static void UI_LoadTremAlienClasses( void )
uiInfo.tremAlienClassList[ 0 ].text =
String_Alloc( BG_FindHumanNameForClassNum( PCL_A_O_BASE ) );
uiInfo.tremAlienClassList[ 0 ].cmd =
- String_Alloc( va( "cmd class %s", BG_FindNameForClassNum( PCL_A_O_BASE ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( PCL_A_O_BASE ) ) );
uiInfo.tremAlienClassList[ 0 ].infopane =
UI_FindInfoPaneByName( va( "%sclass", BG_FindNameForClassNum( PCL_A_O_BASE ) ) );
@@ -3358,7 +3358,7 @@ static void UI_LoadTremAlienClasses( void )
uiInfo.tremAlienClassList[ 1 ].text =
String_Alloc( BG_FindHumanNameForClassNum( bClass ) );
uiInfo.tremAlienClassList[ 1 ].cmd =
- String_Alloc( va( "cmd class %s", BG_FindNameForClassNum( bClass ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( bClass ) ) );
uiInfo.tremAlienClassList[ 1 ].infopane =
UI_FindInfoPaneByName( va( "%sclass", BG_FindNameForClassNum( bClass ) ) );
}
@@ -3375,14 +3375,14 @@ static void UI_LoadTremHumanItems( void )
uiInfo.tremHumanItemList[ 0 ].text =
String_Alloc( BG_FindHumanNameForWeapon( WP_MACHINEGUN ) );
uiInfo.tremHumanItemList[ 0 ].cmd =
- String_Alloc( va( "cmd class %s", BG_FindNameForWeapon( WP_MACHINEGUN ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( WP_MACHINEGUN ) ) );
uiInfo.tremHumanItemList[ 0 ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( WP_MACHINEGUN ) ) );
uiInfo.tremHumanItemList[ 1 ].text =
String_Alloc( BG_FindHumanNameForWeapon( WP_HBUILD ) );
uiInfo.tremHumanItemList[ 1 ].cmd =
- String_Alloc( va( "cmd class %s", BG_FindNameForWeapon( WP_HBUILD ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( WP_HBUILD ) ) );
uiInfo.tremHumanItemList[ 1 ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( WP_HBUILD ) ) );
}
@@ -3486,7 +3486,7 @@ static void UI_LoadTremHumanArmouryBuys( )
uiInfo.tremHumanArmouryBuyList[ j ].text =
String_Alloc( BG_FindHumanNameForWeapon( i ) );
uiInfo.tremHumanArmouryBuyList[ j ].cmd =
- String_Alloc( va( "cmd buy %s retrigger", BG_FindNameForWeapon( i ) ) );
+ String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForWeapon( i ) ) );
uiInfo.tremHumanArmouryBuyList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( i ) ) );
@@ -3506,7 +3506,7 @@ static void UI_LoadTremHumanArmouryBuys( )
uiInfo.tremHumanArmouryBuyList[ j ].text =
String_Alloc( BG_FindHumanNameForUpgrade( i ) );
uiInfo.tremHumanArmouryBuyList[ j ].cmd =
- String_Alloc( va( "cmd buy %s retrigger", BG_FindNameForUpgrade( i ) ) );
+ String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForUpgrade( i ) ) );
uiInfo.tremHumanArmouryBuyList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForUpgrade( i ) ) );
@@ -3536,7 +3536,7 @@ static void UI_LoadTremHumanArmourySells( )
{
uiInfo.tremHumanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForWeapon( i ) );
uiInfo.tremHumanArmourySellList[ j ].cmd =
- String_Alloc( va( "cmd sell %s retrigger", BG_FindNameForWeapon( i ) ) );
+ String_Alloc( va( "cmd sell %s retrigger\n", BG_FindNameForWeapon( i ) ) );
uiInfo.tremHumanArmourySellList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( i ) ) );
@@ -3552,7 +3552,7 @@ static void UI_LoadTremHumanArmourySells( )
{
uiInfo.tremHumanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForUpgrade( i ) );
uiInfo.tremHumanArmourySellList[ j ].cmd =
- String_Alloc( va( "cmd sell %s retrigger", BG_FindNameForUpgrade( i ) ) );
+ String_Alloc( va( "cmd sell %s retrigger\n", BG_FindNameForUpgrade( i ) ) );
uiInfo.tremHumanArmourySellList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForUpgrade( i ) ) );
@@ -3587,7 +3587,7 @@ static void UI_LoadTremAlienUpgrades( )
{
uiInfo.tremAlienUpgradeList[ j ].text = String_Alloc( BG_FindHumanNameForClassNum( i ) );
uiInfo.tremAlienUpgradeList[ j ].cmd =
- String_Alloc( va( "cmd class %s", BG_FindNameForClassNum( i ) ) );
+ String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( i ) ) );
uiInfo.tremAlienUpgradeList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sclass", BG_FindNameForClassNum( i ) ) );
@@ -3623,7 +3623,7 @@ static void UI_LoadTremAlienBuilds( )
uiInfo.tremAlienBuildList[ j ].text =
String_Alloc( BG_FindHumanNameForBuildable( i ) );
uiInfo.tremAlienBuildList[ j ].cmd =
- String_Alloc( va( "cmd build %s", BG_FindNameForBuildable( i ) ) );
+ String_Alloc( va( "cmd build %s\n", BG_FindNameForBuildable( i ) ) );
uiInfo.tremAlienBuildList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sbuild", BG_FindNameForBuildable( i ) ) );
@@ -3661,7 +3661,7 @@ static void UI_LoadTremHumanBuilds( )
uiInfo.tremHumanBuildList[ j ].text =
String_Alloc( BG_FindHumanNameForBuildable( i ) );
uiInfo.tremHumanBuildList[ j ].cmd =
- String_Alloc( va( "cmd build %s", BG_FindNameForBuildable( i ) ) );
+ String_Alloc( va( "cmd build %s\n", BG_FindNameForBuildable( i ) ) );
uiInfo.tremHumanBuildList[ j ].infopane =
UI_FindInfoPaneByName( va( "%sbuild", BG_FindNameForBuildable( i ) ) );
@@ -4205,12 +4205,6 @@ static void UI_RunMenuScript(char **args) {
if( cmd = uiInfo.tremHumanBuildList[ uiInfo.tremHumanBuildIndex ].cmd )
trap_Cmd_ExecuteText( EXEC_APPEND, cmd );
}
- else if( Q_stricmp( name, "SetBankDefaults" ) == 0 )
- trap_Cvar_Set( "ui_bank", "0" );
- else if( Q_stricmp( name, "BankDeposit" ) == 0 )
- trap_Cmd_ExecuteText( EXEC_APPEND, va( "cmd deposit %d", (int)trap_Cvar_VariableValue( "ui_bank" ) ) );
- else if( Q_stricmp( name, "BankWithdraw" ) == 0 )
- trap_Cmd_ExecuteText( EXEC_APPEND, va( "cmd withdraw %d", (int)trap_Cvar_VariableValue( "ui_bank" ) ) );
//TA: tremulous menus
else if (Q_stricmp(name, "playMovie") == 0) {