Quake3World.com Forums
     Programming Discussion
        Key captures in cgame


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Key captures in cgame

Insane Quaker
Insane Quaker
Joined: 05 Mar 2010
Posts: 384
PostPosted: 05-10-2013 11:34 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hey all,

I'm trying to add an introduction menu to display when a client initially connects to a server. It does a key capture, bringing up the cursor allowing you to click on a button to join the game. I'd got the menu loading, but ran into 2 problems:
1. the action events don't work (ie: if you click on a button it does nothing) among other things such as transition events
2. it blocks the main menu from opening when pressing esc

This is using TA's ui menu script code btw. Here's the main function that is accessed through CG_Draw2D(), pretty short and simple:

Code:
static qboolean CG_DrawIntro( void ) {
   playerState_t   *ps = &cg.predictedPlayerState;

   if ( ps->persistant[PERS_TEAM] != TEAM_SPECTATOR ) return qfalse;
   if ( ps->persistant[PERS_SPECTATOR] != SPECTATOR_INTRO ) return qfalse;

   if ( menuIntro ) {
      menuIntro->window.flags &= ~WINDOW_FORCED;
      menuIntro->window.flags |= WINDOW_MOUSEOVER;
      menuIntro->window.flags |= WINDOW_HASFOCUS;
   }

   menuIntro = Menus_FindByName( "joingame_menu" );

   if ( menuIntro ) {
      Menu_Paint( menuIntro, qtrue );
      trap_Key_SetCatcher( KEYCATCH_UI );
   }

   //trap_ShowIntroMenu();
   return qtrue;
}


I've fiddled around for a while without success. I've tried the other key capture options to set it on a lower priority one than the main menu such as KEYCATCH_CGAME but then the game crashes. Loading it through the UI module with a system call had about the same result only that the scoreboard was blocked instead of the main menu - I'd like both to be accessible while the menu is showing. Is there something else that needs to be initialised? Anyone with a solution?




Top
                 

Gibblet
Gibblet
Joined: 03 Apr 2013
Posts: 19
PostPosted: 05-10-2013 12:18 PM           Profile Send private message  E-mail  Edit post Reply with quote


Maybe adding :
Code:
int    key;

   if ( cgs.gametype == GT_TEAM ) {
      
      if (key == TEAM_RED)
         trap_SendClientCommand( "team r" );
      else
         trap_SendClientCommand( "team b" );
   } else
      trap_SendClientCommand( "team p" );




Top
                 

Insane Quaker
Insane Quaker
Joined: 05 Mar 2010
Posts: 384
PostPosted: 05-11-2013 03:46 AM           Profile Send private message  E-mail  Edit post Reply with quote


The menu script handles that.

Still not getting anywhere. I've also tried these one by one:
Menu_Init( menuIntro );

menuIntro = Menu_GetFocused();

Menus_Activate( menuIntro );




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.