Xonotic
cl_minigames_hud.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

float HUD_Minigame_InputEvent (float bInputType, float nPrimary, float nSecondary)
 
void HUD_Minigame_Mouse ()
 
void HUD_MinigameMenu_Close (entity this, entity actor, entity trigger)
 
void HUD_MinigameMenu_CustomEntry (entity parent, string message, string event_arg)
 
float HUD_MinigameMenu_IsOpened ()
 

Function Documentation

◆ HUD_Minigame_InputEvent()

float HUD_Minigame_InputEvent ( float  bInputType,
float  nPrimary,
float  nSecondary 
)

Definition at line 607 of file cl_minigames_hud.qc.

References active_minigame, argv(), autocvar__hud_configure, HUD_MinigameMenu_activeitem, HUD_MinigameMenu_Click(), HUD_MinigameMenu_Close(), HUD_MinigameMenu_entries, HUD_MinigameMenu_IsOpened(), HUD_MinigameMenu_last_entry, HUD_mouse_over(), HUD_PANEL, hudShiftState, K_ALT, K_CTRL, K_DOWNARROW, K_END, K_ENTER, K_ESCAPE, K_HOME, K_KP_DOWNARROW, K_KP_END, K_KP_ENTER, K_KP_HOME, K_KP_UPARROW, K_MOUSE1, K_MOUSE16, K_MOUSE2, K_SHIFT, K_SPACE, K_UPARROW, mouseClicked, mousepos, NULL, S_ALT, S_CTRL, S_MOUSE1, S_MOUSE2, S_SHIFT, stof(), strcat(), and tokenize().

Referenced by CSQC_InputEvent().

608 {
609 
611  return false;
612 
613  if(bInputType == 3)
614  {
615  mousepos_x = nPrimary;
616  mousepos_y = nSecondary;
617  if ( active_minigame && HUD_mouse_over(HUD_PANEL(MINIGAMEBOARD)) )
618  active_minigame.minigame_event(active_minigame,"mouse_moved",mousepos);
619  return true;
620  }
621 
622  if(bInputType == 2)
623  {
624  if ( active_minigame && HUD_mouse_over(HUD_PANEL(MINIGAMEBOARD)) )
625  active_minigame.minigame_event(active_minigame,"mouse_moved",mousepos);
626  return false;
627  }
628 
629  // at this point bInputType can only be 0 or 1 (key pressed or released)
630  bool key_pressed = (bInputType == 0);
631 
632  if(key_pressed) {
633  if(nPrimary == K_ALT) hudShiftState |= S_ALT;
634  if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
635  if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
636  if(nPrimary == K_MOUSE1) mouseClicked |= S_MOUSE1;
637  if(nPrimary == K_MOUSE2) mouseClicked |= S_MOUSE2;
638  }
639  else {
640  if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
641  if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
642  if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
643  if(nPrimary == K_MOUSE1) mouseClicked -= (mouseClicked & S_MOUSE1);
644  if(nPrimary == K_MOUSE2) mouseClicked -= (mouseClicked & S_MOUSE2);
645  }
646 
647  // allow some binds
648  string con_keys = findkeysforcommand("toggleconsole", 0);
649  int keys = tokenize(con_keys); // findkeysforcommand returns data for this
650  int i;
651  for (i = 0; i < keys; ++i)
652  {
653  if(nPrimary == stof(argv(i)))
654  return false;
655  }
656 
657  if ( active_minigame )
658  {
659  string device = "";
660  string action = key_pressed ? "pressed" : "released";
661  if ( nPrimary >= K_MOUSE1 && nPrimary <= K_MOUSE16 )
662  {
663  if ( HUD_mouse_over(HUD_PANEL(MINIGAMEBOARD)) )
664  device = "mouse";
665  }
666  else
667  device = "key";
668 
669  if ( device && active_minigame.minigame_event(
670  active_minigame,strcat(device,"_",action),nPrimary) )
671  return true;
672  }
673 
674  if ( nPrimary == K_MOUSE2 )
675  {
676  return true;
677  }
678  if ( nPrimary == K_MOUSE1 )
679  {
680  if (!key_pressed)
681  return true;
684  return true;
685  }
686  if ( nPrimary == K_UPARROW || nPrimary == K_KP_UPARROW )
687  {
688  if (!key_pressed)
689  return true;
692  else
694  return true;
695  }
696  else if ( nPrimary == K_DOWNARROW || nPrimary == K_KP_DOWNARROW )
697  {
698  if (!key_pressed)
699  return true;
702  else
704  return true;
705  }
706  else if ( nPrimary == K_HOME || nPrimary == K_KP_HOME )
707  {
708  if (!key_pressed)
709  return true;
711  return true;
712  }
713  else if ( nPrimary == K_END || nPrimary == K_KP_END )
714  {
715  if (!key_pressed)
716  return true;
718  return true;
719  }
720  else if ( nPrimary == K_KP_ENTER || nPrimary == K_ENTER || nPrimary == K_SPACE )
721  {
722  if (!key_pressed)
723  return true;
725  return true;
726  }
727  else if ( nPrimary == K_ESCAPE )
728  {
729  if (!key_pressed)
730  return true;
732  return true;
733  }
734 
735  return false;
736 }
float K_UPARROW
Definition: keycodes.qc:15
float K_ALT
Definition: keycodes.qc:20
float K_ESCAPE
Definition: keycodes.qc:9
float K_DOWNARROW
Definition: keycodes.qc:16
bool HUD_MinigameMenu_IsOpened()
bool autocvar__hud_configure
Definition: hud_config.qh:3
float K_HOME
Definition: keycodes.qc:41
float K_KP_DOWNARROW
Definition: keycodes.qc:53
const int S_SHIFT
Definition: hud.qh:127
void HUD_MinigameMenu_Click(entity menuitem)
void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
entity HUD_MinigameMenu_activeitem
float K_SHIFT
Definition: keycodes.qc:22
float K_SPACE
Definition: keycodes.qc:10
const int S_ALT
Definition: hud.qh:129
float K_KP_ENTER
Definition: keycodes.qc:74
int mouseClicked
Definition: hud_config.qh:12
bool HUD_mouse_over(entity somepanel)
entity active_minigame
Definition: cl_minigames.qh:85
int hudShiftState
Definition: hud.qh:126
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
entity HUD_MinigameMenu_entries
float K_MOUSE16
Definition: keycodes.qc:146
float K_CTRL
Definition: keycodes.qc:21
float K_MOUSE2
Definition: keycodes.qc:130
#define NULL
Definition: post.qh:17
entity HUD_MinigameMenu_last_entry
float K_END
Definition: keycodes.qc:42
float K_MOUSE1
Definition: keycodes.qc:129
float K_KP_HOME
Definition: keycodes.qc:62
vector mousepos
Definition: hud.qh:102
const int S_MOUSE2
Definition: hud_config.qh:10
float K_ENTER
Definition: keycodes.qc:8
const int S_MOUSE1
Definition: hud_config.qh:9
const int S_CTRL
Definition: hud.qh:128
float K_KP_END
Definition: keycodes.qc:51
float K_KP_UPARROW
Definition: keycodes.qc:64
#define HUD_PANEL(NAME)
Definition: hud.qh:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_Minigame_Mouse()

void HUD_Minigame_Mouse ( )

Definition at line 738 of file cl_minigames_hud.qc.

References autocvar__hud_configure, HUD_MinigameMenu_IsOpened(), HUD_MinigameMenu_MouseInput(), HUD_mouse_over(), HUD_PANEL, and mv_active.

Referenced by HUD_Mouse().

739 {
741  return;
742 
743  if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAMEMENU)) )
745 }
bool HUD_MinigameMenu_IsOpened()
bool autocvar__hud_configure
Definition: hud_config.qh:3
float mv_active
Definition: mapvoting.qh:19
void HUD_MinigameMenu_MouseInput()
bool HUD_mouse_over(entity somepanel)
#define HUD_PANEL(NAME)
Definition: hud.qh:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_MinigameMenu_Close()

void HUD_MinigameMenu_Close ( entity  this,
entity  actor,
entity  trigger 
)

Definition at line 378 of file cl_minigames_hud.qc.

References entity(), HUD_MinigameMenu_activeitem, HUD_MinigameMenu_entries, HUD_MinigameMenu_IsOpened(), HUD_MinigameMenu_last_entry, and NULL.

Referenced by deactivate_minigame(), HUD_Minigame_InputEvent(), HUD_MinigameMenu(), MUTATOR_HOOKFUNCTION(), and Shutdown().

379 {
381  {
382  entity e, p;
383  for ( e = HUD_MinigameMenu_entries; e != NULL; e = p )
384  {
385  p = e.list_next;
386  delete(e);
387  }
391  }
392 }
bool HUD_MinigameMenu_IsOpened()
entity() spawn
entity HUD_MinigameMenu_activeitem
entity HUD_MinigameMenu_entries
#define NULL
Definition: post.qh:17
entity HUD_MinigameMenu_last_entry
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_MinigameMenu_CustomEntry()

void HUD_MinigameMenu_CustomEntry ( entity  parent,
string  message,
string  event_arg 
)

Definition at line 348 of file cl_minigames_hud.qc.

References entity(), HUD_MinigameMenu_ClickCustomEntry(), HUD_MinigameMenu_InsertEntry(), and HUD_MinigameMenu_SpawnSubEntry().

349 {
352  e.netname = event_arg;
354  //dprint("CustomEntry ",ftos(num_for_edict(parent))," ",menumessage," ",event_arg,"\n");
355 }
void HUD_MinigameMenu_ClickCustomEntry(entity this, entity actor, entity trigger)
entity parent
Definition: animhost.qc:7
entity() spawn
void HUD_MinigameMenu_InsertEntry(entity newentry, entity prev)
entity HUD_MinigameMenu_SpawnSubEntry(string s, void(entity, entity, entity) click, entity parent)
+ Here is the call graph for this function:

◆ HUD_MinigameMenu_IsOpened()

float HUD_MinigameMenu_IsOpened ( )

Definition at line 372 of file cl_minigames_hud.qc.

References HUD_MinigameMenu_entries, and NULL.

Referenced by activate_minigame(), HUD_Crosshair(), HUD_Minigame_InputEvent(), HUD_Minigame_Mouse(), HUD_MinigameBoard(), HUD_MinigameHelp(), HUD_MinigameMenu(), HUD_MinigameMenu_Close(), HUD_MinigameMenu_Open(), HUD_MinigameStatus(), HUD_Mouse(), HUD_Panel_Draw(), HUD_QuickMenu_Forbidden(), HUD_WouldShowCursor(), minigame_prompt(), MUTATOR_HOOKFUNCTION(), Scoreboard_WouldDraw(), View_CheckButtonStatus(), and View_Lock().

373 {
374  return HUD_MinigameMenu_entries != NULL;
375 }
entity HUD_MinigameMenu_entries
#define NULL
Definition: post.qh:17
+ Here is the caller graph for this function: