From 3e746cde9f3bed3750ed86b53999478236a58f60 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 17 Dec 2001 00:11:55 +0000 Subject: Added check for ceiling building. Fixed missing menu bug --- src/cgame/cg_event.c | 50 ++++++++++++++++++++++++-------------------------- src/game/bg_public.h | 1 + src/game/g_buildable.c | 11 +++++++++++ src/game/g_cmds.c | 1 + src/game/g_local.h | 1 + src/ui/ui_shared.h | 2 +- 6 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index ef458326..1896f013 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -410,34 +410,32 @@ CG_Menu */ void CG_Menu( int eventParm ) { - char menuDef[ MAX_STRING_CHARS ]; - int i; - switch( eventParm ) { - case MN_TEAM: trap_SendConsoleCommand( "menu tremulous_teamselect\n" ); break; - case MN_D_CLASS: trap_SendConsoleCommand( "menu tremulous_alienclass\n" ); break; - case MN_H_SPAWN: trap_SendConsoleCommand( "menu tremulous_humanitem\n" ); break; - case MN_D_BUILD: trap_SendConsoleCommand( "menu tremulous_alienbuild\n" ); break; - case MN_H_BUILD: trap_SendConsoleCommand( "menu tremulous_humanbuild\n" ); break; - case MN_H_MCU: trap_SendConsoleCommand( "menu tremulous_humanmcu\n" ); break; - case MN_H_BANK: trap_SendConsoleCommand( "menu tremulous_humanbank\n" ); break; - case MN_H_NOROOM: trap_SendConsoleCommand( "menu tremulous_human_no_room\n" ); break; - case MN_H_NOPOWER: trap_SendConsoleCommand( "menu tremulous_human_no_power\n" ); break; - case MN_D_NOROOM: trap_SendConsoleCommand( "menu tremulous_alien_no_room\n" ); break; - case MN_D_NOCREEP: trap_SendConsoleCommand( "menu tremulous_alien_no_creep\n" ); break; - case MN_D_NOHVMND: trap_SendConsoleCommand( "menu tremulous_alien_no_hivemind\n" ); break; - case MN_D_HIVEMIND: trap_SendConsoleCommand( "menu tremulous_alien_one_hivemind\n" ); break; - case MN_D_NOASSERT: trap_SendConsoleCommand( "menu tremulous_alien_no_assertion\n" ); break; - case MN_D_SPWNWARN: trap_SendConsoleCommand( "menu tremulous_alien_egg_warning\n" ); break; - case MN_H_REACTOR: trap_SendConsoleCommand( "menu tremulous_human_one_reactor\n" ); break; - case MN_H_REPEATER: trap_SendConsoleCommand( "menu tremulous_human_repeater\n" ); break; - case MN_H_RPLWARN: trap_SendConsoleCommand( "menu tremulous_human_replicator_warning\n" ); break; - case MN_H_RPTWARN: trap_SendConsoleCommand( "menu tremulous_human_repeater_warning\n" ); break; - case MN_H_NOSLOTS: trap_SendConsoleCommand( "menu tremulous_human_no_slots\n" ); break; - case MN_H_NOFUNDS: trap_SendConsoleCommand( "menu tremulous_human_no_funds\n" ); break; - case MN_H_ITEMHELD: trap_SendConsoleCommand( "menu tremulous_human_item_held\n" ); break; - case MN_D_INFEST: trap_SendConsoleCommand( "menu dinfest\n" ); break; + case MN_TEAM: trap_SendConsoleCommand( "menu tremulous_teamselect\n" ); break; + case MN_D_CLASS: trap_SendConsoleCommand( "menu tremulous_alienclass\n" ); break; + case MN_H_SPAWN: trap_SendConsoleCommand( "menu tremulous_humanitem\n" ); break; + case MN_D_BUILD: trap_SendConsoleCommand( "menu tremulous_alienbuild\n" ); break; + case MN_H_BUILD: trap_SendConsoleCommand( "menu tremulous_humanbuild\n" ); break; + case MN_H_MCU: trap_SendConsoleCommand( "menu tremulous_humanmcu\n" ); break; + case MN_H_BANK: trap_SendConsoleCommand( "menu tremulous_humanbank\n" ); break; + case MN_H_NOROOM: trap_SendConsoleCommand( "menu tremulous_human_no_room\n" ); break; + case MN_H_NOPOWER: trap_SendConsoleCommand( "menu tremulous_human_no_power\n" ); break; + case MN_D_NOROOM: trap_SendConsoleCommand( "menu tremulous_alien_no_room\n" ); break; + case MN_D_NOCREEP: trap_SendConsoleCommand( "menu tremulous_alien_no_creep\n" ); break; + case MN_D_NOHVMND: trap_SendConsoleCommand( "menu tremulous_alien_no_hivemind\n" ); break; + case MN_D_HIVEMIND: trap_SendConsoleCommand( "menu tremulous_alien_one_hivemind\n" ); break; + case MN_D_NOASSERT: trap_SendConsoleCommand( "menu tremulous_alien_no_assertion\n" ); break; + case MN_D_SPWNWARN: trap_SendConsoleCommand( "menu tremulous_alien_egg_warning\n" ); break; + case MN_D_NORMAL: trap_SendConsoleCommand( "menu tremulous_alien_surface\n" ); break; + case MN_H_REACTOR: trap_SendConsoleCommand( "menu tremulous_human_one_reactor\n" ); break; + case MN_H_REPEATER: trap_SendConsoleCommand( "menu tremulous_human_repeater\n" ); break; + case MN_H_RPLWARN: trap_SendConsoleCommand( "menu tremulous_human_replicator_warning\n" ); break; + case MN_H_RPTWARN: trap_SendConsoleCommand( "menu tremulous_human_repeater_warning\n" ); break; + case MN_H_NOSLOTS: trap_SendConsoleCommand( "menu tremulous_human_no_slots\n" ); break; + case MN_H_NOFUNDS: trap_SendConsoleCommand( "menu tremulous_human_no_funds\n" ); break; + case MN_H_ITEMHELD: trap_SendConsoleCommand( "menu tremulous_human_item_held\n" ); break; + case MN_D_INFEST: trap_SendConsoleCommand( "menu dinfest\n" ); break; default: Com_Printf( "cgame: debug: no such menu %d\n", eventParm ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index cfd603d6..9663e884 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -566,6 +566,7 @@ typedef enum MN_D_HIVEMIND, MN_D_NOASSERT, MN_D_SPWNWARN, + MN_D_NORMAL, MN_H_SPAWN, MN_H_BUILD, MN_H_MCU, diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 41b6d4f9..e7ac1cbd 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1576,6 +1576,13 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) { //droid criteria + + float minNormal = BG_FindMinNormalForBuildable( buildable ); + qboolean invert = BG_FindInvertNormalForBuildable( buildable ); + + //can we build at this angle? + if( !( normal[ 2 ] >= minNormal || ( invert && normal[ 2 ] <= -minNormal ) ) ) + return IBE_NORMAL; //look for a hivemind for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) @@ -1902,6 +1909,10 @@ void G_ValidateBuild( gentity_t *ent, buildable_t buildable ) G_AddPredictableEvent( ent, EV_MENU, MN_D_HIVEMIND ); break; + case IBE_NORMAL: + G_AddPredictableEvent( ent, EV_MENU, MN_D_NORMAL ); + break; + case IBE_REACTOR: G_AddPredictableEvent( ent, EV_MENU, MN_H_REACTOR ); break; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 1f6c5e68..d99013b1 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2120,6 +2120,7 @@ void Cmd_Build_f( gentity_t *ent ) case IBE_RPTWARN: case IBE_SPWNWARN: case IBE_NOROOM: + case IBE_NORMAL: ent->client->ps.stats[ STAT_BUILDABLE ] = ( buildable | SB_VALID_TOGGLEBIT ); break; diff --git a/src/game/g_local.h b/src/game/g_local.h index c9a78a5e..7ad59093 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -537,6 +537,7 @@ typedef enum IBE_RPLWARN, IBE_RPTWARN, IBE_NOPOWER, + IBE_NORMAL, IBE_MAXERRORS } itemBuildError_t; diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index a84070cf..8d67fce1 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -26,7 +26,7 @@ #define MAX_ITEMACTION 64 #define MAX_MENUDEFFILE 4096 #define MAX_MENUFILE 32768 -#define MAX_MENUS 64 +#define MAX_MENUS 256 #define MAX_MENUITEMS 96 #define MAX_COLOR_RANGES 10 #define MAX_OPEN_MENUS 16 -- cgit