Xonotic
gametypelist.qc File Reference
+ Include dependency graph for gametypelist.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity makeXonoticGametypeList ()
 
void XonoticGametypeList_clickListBoxItem (entity me, float i, vector where)
 
void XonoticGametypeList_configureXonoticGametypeList (entity me)
 
void XonoticGametypeList_draw (entity me)
 
void XonoticGametypeList_drawListBoxItem (entity me, int i, vector absSize, bool isSelected, bool isFocused)
 
void XonoticGametypeList_focusedItemChangeNotify (entity me)
 
float XonoticGametypeList_keyDown (entity me, float scan, float ascii, float shift)
 
void XonoticGametypeList_loadCvars (entity me)
 
void XonoticGametypeList_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 
void XonoticGametypeList_saveCvars (entity me)
 
void XonoticGametypeList_setSelected (entity me, float i)
 

Function Documentation

◆ makeXonoticGametypeList()

entity makeXonoticGametypeList ( )

Definition at line 7 of file gametypelist.qc.

References entity(), and NEW.

8 {
9  entity me;
11  me.configureXonoticGametypeList(me);
12  return me;
13 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:

◆ XonoticGametypeList_clickListBoxItem()

void XonoticGametypeList_clickListBoxItem ( entity  me,
float  i,
vector  where 
)

Definition at line 127 of file gametypelist.qc.

References m_play_click_sound(), and MENU_SOUND_SELECT.

128 {
130 }
+ Here is the call graph for this function:

◆ XonoticGametypeList_configureXonoticGametypeList()

void XonoticGametypeList_configureXonoticGametypeList ( entity  me)

Definition at line 14 of file gametypelist.qc.

References draw_PreloadPictureWithFlags(), GameType_GetCount(), GameType_GetIcon(), GameType_GetTotalCount(), and PRECACHE_PIC_MIPMAP.

15 {
16  me.configureXonoticListBox(me);
17  me.nItems = GameType_GetCount();
18 
19  if(SKINBOOL_GAMETYPELIST_ICON_BLUR)
20  {
21  for(int i = 0; i < GameType_GetTotalCount(); ++i)
23  }
24 
25  me.loadCvars(me);
26 }
float PRECACHE_PIC_MIPMAP
+ Here is the call graph for this function:

◆ XonoticGametypeList_draw()

void XonoticGametypeList_draw ( entity  me)

Definition at line 63 of file gametypelist.qc.

References GameType_GetCount(), and SUPER.

64 {
65  if(me.nItems != GameType_GetCount())
66  {
67  me.nItems = GameType_GetCount();
68  me.setSelected(me, 0);
69  }
70  SUPER(XonoticGametypeList).draw(me);
71 }
#define SUPER(cname)
Definition: oo.qh:219
+ Here is the call graph for this function:

◆ XonoticGametypeList_drawListBoxItem()

void XonoticGametypeList_drawListBoxItem ( entity  me,
int  i,
vector  absSize,
bool  isSelected,
bool  isFocused 
)

Definition at line 72 of file gametypelist.qc.

References _MapInfo_GetTeamPlayBool(), draw_Fill(), draw_Picture(), eX, eY, GameType_GetIcon(), GameType_GetID(), GameType_GetName(), getFadedAlpha(), s1, and s2.

73 {
74  string s1, s2;
75 
76  if(isSelected)
77  draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
78  else if(isFocused)
79  {
80  me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
81  draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
82  }
83 
84  draw_Picture(me.columnIconOrigin * eX, GameType_GetIcon(i), me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
85  s1 = GameType_GetName(i);
86 
88  s2 = _("teamplay");
89  else
90  s2 = _("free for all");
91 
92  vector save_fontscale = draw_fontscale;
93  float f = draw_CondensedFontFactor(strcat(s1, " ", s2), false, me.realFontSize, 1);
94  draw_fontscale.x *= f;
95  vector fs = me.realFontSize;
96  fs.x *= f;
97  draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s1, fs, '1 1 1', SKINALPHA_TEXT, 0);
98  draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1.0 * (me.columnNameSize - draw_TextWidth(s2, 0, fs))) * eX, s2, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
99  draw_fontscale = save_fontscale;
100 }
spree_inf s1 s2 s3loc s2 s1
Definition: all.inc:265
const vector eY
Definition: vector.qh:45
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1 f1points s1 s2
Definition: all.inc:438
float _MapInfo_GetTeamPlayBool(Gametype t)
Definition: mapinfo.qc:507
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"))
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
+ Here is the call graph for this function:

◆ XonoticGametypeList_focusedItemChangeNotify()

void XonoticGametypeList_focusedItemChangeNotify ( entity  me)

Definition at line 131 of file gametypelist.qc.

References clearTooltip(), GameType_GetID(), MapInfo_Type_Description(), setZonedTooltip(), and string_null.

132 {
133  if(me.focusedItem >= 0)
135  else
136  clearTooltip(me);
137 }
string string_null
Definition: nil.qh:9
string MapInfo_Type_Description(Gametype t)
Definition: mapinfo.qc:611
+ Here is the call graph for this function:

◆ XonoticGametypeList_keyDown()

float XonoticGametypeList_keyDown ( entity  me,
float  scan,
float  ascii,
float  shift 
)

Definition at line 116 of file gametypelist.qc.

References K_ENTER, K_KP_ENTER, m_play_click_sound(), MENU_SOUND_EXECUTE, and SUPER.

117 {
118  if(scan == K_ENTER || scan == K_KP_ENTER)
119  {
121  me.parent.gameTypeSelectNotify(me.parent);
122  return 1;
123  }
124 
125  return SUPER(XonoticGametypeList).keyDown(me, scan, ascii, shift);
126 }
float K_KP_ENTER
Definition: keycodes.qc:74
#define SUPER(cname)
Definition: oo.qh:219
float K_ENTER
Definition: keycodes.qc:8
+ Here is the call graph for this function:

◆ XonoticGametypeList_loadCvars()

void XonoticGametypeList_loadCvars ( entity  me)

Definition at line 32 of file gametypelist.qc.

References cnt, GameType_GetCount(), GameType_GetID(), and MapInfo_CurrentGametype().

33 {
35  int cnt = GameType_GetCount();
36  float i;
37  for(i = 0; i < cnt; ++i)
38  if(t == GameType_GetID(i))
39  break;
40  if(i >= cnt)
41  {
42  for(i = 0; i < cnt; ++i)
43  if(t == MAPINFO_TYPE_DEATHMATCH)
44  break;
45  if(i >= cnt)
46  i = 0;
47  }
48  me.setSelected(me, i);
49  // do we need this: me.parent.gameTypeChangeNotify(me.parent); // to make sure
50 }
Gametype MapInfo_CurrentGametype()
Definition: mapinfo.qc:1150
float cnt
Definition: powerups.qc:24
+ Here is the call graph for this function:

◆ XonoticGametypeList_resizeNotify()

void XonoticGametypeList_resizeNotify ( entity  me,
vector  relOrigin,
vector  relSize,
vector  absOrigin,
vector  absSize 
)

Definition at line 101 of file gametypelist.qc.

References SUPER.

102 {
103  me.itemAbsSize = '0 0 0';
104  SUPER(XonoticGametypeList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
105 
106  me.itemAbsSize.y = absSize.y * me.itemHeight;
107  me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
108  me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
109  me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
110  me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
111  me.columnIconOrigin = 0;
112  me.columnIconSize = me.itemAbsSize.y / me.itemAbsSize.x;
113  me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize.x);
114  me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize.x);
115 }
#define SUPER(cname)
Definition: oo.qh:219

◆ XonoticGametypeList_saveCvars()

void XonoticGametypeList_saveCvars ( entity  me)

Definition at line 51 of file gametypelist.qc.

References entity(), GameType_GetID(), MapInfo_CurrentGametype(), MapInfo_SwitchGameType(), and owner.

52 {
53  Gametype t = GameType_GetID(me.selectedItem);
54  if (t == MapInfo_CurrentGametype()) {
55  return;
56  }
58  entity owner = me.parent;
59  if (owner) { // not set immediately
60  owner.gameTypeChangeNotify(owner);
61  }
62 }
entity() spawn
entity owner
Definition: main.qh:73
Gametype MapInfo_CurrentGametype()
Definition: mapinfo.qc:1150
void MapInfo_SwitchGameType(Gametype t)
Definition: mapinfo.qc:1178
+ Here is the call graph for this function:

◆ XonoticGametypeList_setSelected()

void XonoticGametypeList_setSelected ( entity  me,
float  i 
)

Definition at line 27 of file gametypelist.qc.

References SUPER.

28 {
29  SUPER(XonoticGametypeList).setSelected(me, i);
30  me.saveCvars(me);
31 }
#define SUPER(cname)
Definition: oo.qh:219