summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2003-09-03 00:18:51 +0000
committerTim Angus <tim@ngus.net>2003-09-03 00:18:51 +0000
commit4a51da34cefd60b26e0bc154bf3f7976e4d191d7 (patch)
tree0ca3d034312ca534aeaad25835b60d872acee5f0
parent35e6793287a0881333f6018ac2046fc4cd7177d1 (diff)
* Added SURF_NOALIENBUILD and SURF_NOHUMANBUILD so that building can be
prevented via shader
-rw-r--r--src/cgame/cg_servercmds.c10
-rw-r--r--src/game/bg_pmove.c5
-rw-r--r--src/game/bg_public.h37
-rw-r--r--src/game/g_buildable.c35
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/surfaceflags.h4
6 files changed, 67 insertions, 25 deletions
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index f6cef10f..5ad80f98 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -565,6 +565,12 @@ void CG_Menu( int menu )
trap_SendConsoleCommand( "menu tremulous_human_dialog\n" );
break;
+ case MN_H_NORMAL:
+ trap_Cvar_Set( "ui_dialog", "Cannot build on this surface. The surface is too steep or unsuitable "
+ "to build on. Please choose another site for this structure." );
+ trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" );
+ break;
+
case MN_H_REACTOR:
trap_Cvar_Set( "ui_dialog", "There can only be one reactor. Destroy the existing one if you "
"wish to move it." );
@@ -613,6 +619,10 @@ void CG_Menu( int menu )
trap_SendConsoleCommand( "menu tremulous_human_dialog\n" );
break;
+
+ //===============================
+
+
case MN_A_NOROOM:
trap_Cvar_Set( "ui_dialog", "There is no room to build here. Move until the structure turns "
"translucent green indicating a valid build location." );
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 74ab3be2..2fd4a81a 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -1255,7 +1255,10 @@ static void PM_CheckLadder( void )
//test if class can use ladders
if( !BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_CANUSELADDERS ) )
+ {
pml.ladder = qfalse;
+ return;
+ }
VectorCopy( pml.forward, forward );
forward[ 2 ] = 0.0f;
@@ -2887,7 +2890,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
if( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION )
return; // no view changes at all
- if( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 )
+ if( ps->pm_type != PM_SPECTATOR && ps->stats[ STAT_HEALTH ] <= 0 )
return; // no view changes at all
// circularly clamp the angles with deltas
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 748c5ba1..469f58de 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -549,37 +549,44 @@ typedef enum
{
MN_TEAM,
+ //alien stuff
MN_A_CLASS,
MN_A_BUILD,
MN_A_INFEST,
- MN_A_NOROOM,
- MN_A_NOCREEP,
- MN_A_NOOVMND,
- MN_A_OVERMIND,
- MN_A_NOASSERT,
- MN_A_SPWNWARN,
- MN_A_NORMAL,
MN_A_HOVEL_OCCUPIED,
MN_A_HOVEL_BLOCKED,
- MN_A_HOVEL_EXIT,
MN_A_OBANK,
MN_A_NOFUNDS,
MN_A_NOEROOM,
+ //alien build denial menus
+ MN_A_SPWNWARN,
+ MN_A_OVERMIND,
+ MN_A_NOASSERT,
+ MN_A_NOCREEP,
+ MN_A_NOOVMND,
+ MN_A_NOROOM,
+ MN_A_NORMAL,
+ MN_A_HOVEL_EXIT,
+
+ //human stuff
MN_H_SPAWN,
MN_H_BUILD,
MN_H_ARMOURY,
MN_H_BANK,
- MN_H_NOROOM,
- MN_H_NOPOWER,
- MN_H_REACTOR,
- MN_H_REPEATER,
- MN_H_RPLWARN,
- MN_H_RPTWARN,
MN_H_NOSLOTS,
MN_H_NOFUNDS,
+ MN_H_ITEMHELD,
+
+ //human build
+ MN_H_REPEATER,
+ MN_H_NOPOWER,
MN_H_NODCC,
- MN_H_ITEMHELD
+ MN_H_REACTOR,
+ MN_H_NOROOM,
+ MN_H_NORMAL,
+ MN_H_RPLWARN,
+ MN_H_RPTWARN
} dynMenu_t;
// animations
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index b1152e3e..fab860a2 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2033,14 +2033,6 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
{
//alien criteria
- //check there is creep near by for building on
-
- if( BG_FindCreepTestForBuildable( buildable ) )
- {
- if( !isCreep( entity_origin ) )
- reason = IBE_NOCREEP;
- }
-
if( buildable == BA_A_HOVEL )
{
vec3_t builderMins, builderMaxs;
@@ -2053,6 +2045,17 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
reason = IBE_HOVELEXIT;
}
+ //check there is creep near by for building on
+ if( BG_FindCreepTestForBuildable( buildable ) )
+ {
+ if( !isCreep( entity_origin ) )
+ reason = IBE_NOCREEP;
+ }
+
+ //check permission to build here
+ if( tr1.surfaceFlags & SURF_NOALIENBUILD )
+ reason = IBE_PERMISSION;
+
//look for a hivemind
for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
{
@@ -2124,6 +2127,10 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
reason = IBE_RPTWARN;
}
+ //check permission to build here
+ if( tr1.surfaceFlags & SURF_NOHUMANBUILD )
+ reason = IBE_PERMISSION;
+
//can we only build one of these?
if( BG_FindUniqueTestForBuildable( buildable ) )
{
@@ -2387,7 +2394,17 @@ qboolean G_ValidateBuild( gentity_t *ent, buildable_t buildable )
return qfalse;
case IBE_NORMAL:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_NORMAL );
+ if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NORMAL );
+ else
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NORMAL );
+ return qfalse;
+
+ case IBE_PERMISSION:
+ if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NORMAL );
+ else
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NORMAL );
return qfalse;
case IBE_REACTOR:
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 7075ea16..3976740e 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -554,6 +554,7 @@ typedef enum
IBE_NORMAL,
IBE_NOROOM,
+ IBE_PERMISSION,
IBE_MAXERRORS
} itemBuildError_t;
diff --git a/src/game/surfaceflags.h b/src/game/surfaceflags.h
index 2a31631e..a6d68dfa 100644
--- a/src/game/surfaceflags.h
+++ b/src/game/surfaceflags.h
@@ -72,3 +72,7 @@
#define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies)
#define SURF_DUST 0x40000 // leave a dust trail when walking on this surface
+//TA: custominfoparms below
+#define SURF_NOALIENBUILD 0x80000 // disallow alien building
+#define SURF_NOHUMANBUILD 0x100000 // disallow alien building
+