Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
nexposee.qc File Reference
#include "nexposee.qh"
Include dependency graph for nexposee.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ExposeeCloseButton_Click (entity button, entity other)
void Nexposee_addItem (entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
void Nexposee_calc (entity me)
void Nexposee_Calc_Scale (entity me, float scale)
void Nexposee_close (entity me)
void Nexposee_draw (entity me)
void Nexposee_focusEnter (entity me)
float Nexposee_keyDown (entity me, float scan, float ascii, float shift)
float Nexposee_keyUp (entity me, float scan, float ascii, float shift)
float Nexposee_mouseDrag (entity me, vector pos)
float Nexposee_mouseMove (entity me, vector pos)
float Nexposee_mouseRelease (entity me, vector pos)
void Nexposee_pullNexposee (entity me, entity other, vector theAlign)
void Nexposee_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
void Nexposee_setNexposee (entity me, entity other, vector scalecenter, float a0, float a1)

Function Documentation

◆ ExposeeCloseButton_Click()

void ExposeeCloseButton_Click ( entity button,
entity other )

Definition at line 8 of file nexposee.qc.

9 {
10 other.selectedChild = other.focusedChild;
11 other.setFocus(other, NULL);
12 other.animationState = 3;
13 }
entity other
#define NULL
Definition post.qh:14

References entity(), NULL, and other.

Referenced by Dialog_close(), and Nexposee::pullNexposee().

◆ Nexposee_addItem()

void Nexposee_addItem ( entity me,
entity other,
vector theOrigin,
vector theSize,
float theAlpha )

Definition at line 279 of file nexposee.qc.

280 {
281 SUPER(Nexposee).addItem(me, other, theOrigin, theSize, theAlpha);
282 other.Nexposee_initialFontScale = other.Container_fontscale;
283 other.Nexposee_initialSize = other.Container_size;
284 other.Nexposee_initialOrigin = other.Container_origin;
285 other.Nexposee_initialAlpha = other.Container_alpha;
286 if (other.Nexposee_initialFontScale == '0 0 0') other.Nexposee_initialFontScale = '1 1 0';
287 }
#define SUPER(cname)
Definition oo.qh:231

References entity(), other, SUPER, and vector.

◆ Nexposee_calc()

void Nexposee_calc ( entity me)

Definition at line 35 of file nexposee.qc.

36 {
37 /*
38 * patented by Apple
39 * can't put that here ;)
40 */
41 float scale;
42 entity e, e2;
43 vector emins, emaxs, e2mins, e2maxs;
44
45 for (scale = 0.7; ; scale *= 0.99)
46 {
48
49 for (e = me.firstChild; e; e = e.nextSibling)
50 {
51 emins = e.Nexposee_smallOrigin;
52 emaxs = emins + e.Nexposee_smallSize;
53 for (e2 = e.nextSibling; e2; e2 = e2.nextSibling)
54 {
55 e2mins = e2.Nexposee_smallOrigin;
56 e2maxs = e2mins + e2.Nexposee_smallSize;
57
58 // two intervals [amins, amaxs] and [bmins, bmaxs] overlap if:
59 // amins < bmins < amaxs < bmaxs
60 // for which suffices
61 // bmins < amaxs
62 // amins < bmaxs
63 if ((e2mins.x - emaxs.x) * (emins.x - e2maxs.x) > 0) // x overlap
64 if ((e2mins.y - emaxs.y) * (emins.y - e2maxs.y) > 0) // y overlap
65 goto have_overlap;
66 }
67 }
68
69 break;
70LABEL(have_overlap)
71 }
72
73 scale *= 0.95;
74
76 }
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define LABEL(id)
Definition compiler.qh:34
void Nexposee_Calc_Scale(entity me, float scale)
Definition nexposee.qc:21
float scale
Definition projectile.qc:14
vector
Definition self.qh:92

References entity(), LABEL, Nexposee_Calc_Scale(), scale, and vector.

◆ Nexposee_Calc_Scale()

void Nexposee_Calc_Scale ( entity me,
float scale )

Definition at line 21 of file nexposee.qc.

22 {
23 entity e;
24 for (e = me.firstChild; e; e = e.nextSibling)
25 {
26 e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter;
27 e.Nexposee_smallSize = e.Nexposee_initialSize * scale;
28 if (e.Nexposee_align.x > 0) e.Nexposee_smallOrigin_x = 1 - e.Nexposee_align.x * scale;
29 if (e.Nexposee_align.x < 0) e.Nexposee_smallOrigin_x = -e.Nexposee_smallSize.x + e.Nexposee_align.x * scale;
30 if (e.Nexposee_align.y > 0) e.Nexposee_smallOrigin_y = 1 - e.Nexposee_align.y * scale;
31 if (e.Nexposee_align.y < 0) e.Nexposee_smallOrigin_y = -e.Nexposee_smallSize.y + e.Nexposee_align.y * scale;
32 }
33 }

References entity(), and scale.

Referenced by Nexposee_calc().

◆ Nexposee_close()

void Nexposee_close ( entity me)

Definition at line 3 of file nexposee.qc.

4 {
5 // user must override this
6 }

References entity().

◆ Nexposee_draw()

void Nexposee_draw ( entity me)

Definition at line 86 of file nexposee.qc.

87 {
88 float a;
89 float a0;
90 entity e;
91 float f;
92 vector fs;
93
94 if (me.animationState == -1) me.animationState = 0;
95
96 f = min(1, frametime * 5);
97 switch (me.animationState)
98 {
99 case 0:
100 me.animationFactor = 0;
101 break;
102 case 1:
103 me.animationFactor += f;
104 if (me.animationFactor >= 1)
105 {
106 me.animationFactor = 1;
107 me.animationState = 2;
108 SUPER(Nexposee).setFocus(me, me.selectedChild);
109 }
110 break;
111 case 2:
112 me.animationFactor = 1;
113 break;
114 case 3:
115 me.animationFactor -= f;
116 me.mouseFocusedChild = me.itemFromPoint(me, me.mousePosition);
117 if (me.animationFactor <= 0)
118 {
119 me.animationFactor = 0;
120 me.animationState = 0;
121 me.selectedChild = me.mouseFocusedChild;
122 }
123 break;
124 }
125
126 f = min(1, frametime * 10);
127 for (e = me.firstChild; e; e = e.nextSibling)
128 {
129 if (e == me.selectedChild)
130 {
131 e.Container_origin = e.Nexposee_smallOrigin * (1 - me.animationFactor) + e.Nexposee_initialOrigin * me.animationFactor;
132 e.Container_size = e.Nexposee_smallSize * (1 - me.animationFactor) + e.Nexposee_initialSize * me.animationFactor;
133 e.Nexposee_animationFactor = me.animationFactor;
134 a0 = e.Nexposee_mediumAlpha;
135 if (me.animationState == 3)
136 if (e != me.mouseFocusedChild) a0 = e.Nexposee_smallAlpha;
137 a = a0 * (1 - me.animationFactor) + me.animationFactor;
138 }
139 else
140 {
141 // minimum theSize counts
142 e.Container_origin = e.Nexposee_smallOrigin;
143 e.Container_size = e.Nexposee_smallSize;
144 e.Nexposee_animationFactor = 0;
145 a = e.Nexposee_smallAlpha * (1 - me.animationFactor);
146 }
147 me.setAlphaOf(me, e, e.Container_alpha * (1 - f) + a * f);
148
149 fs = globalToBoxSize(e.Container_size, e.Nexposee_initialSize);
150 e.Container_fontscale_x = fs.x * e.Nexposee_initialFontScale.x;
151 e.Container_fontscale_y = fs.y * e.Nexposee_initialFontScale.y;
152 }
153
154 SUPER(Nexposee).draw(me);
155 }
float frametime
vector globalToBoxSize(vector v, vector theScale)
Definition draw.qc:38
float min(float f,...)

References entity(), frametime, globalToBoxSize(), min(), SUPER, and vector.

◆ Nexposee_focusEnter()

void Nexposee_focusEnter ( entity me)

Definition at line 289 of file nexposee.qc.

290 {
291 if (me.animationState == 2) SUPER(Nexposee).setFocus(me, me.selectedChild);
292 }

References entity(), and SUPER.

◆ Nexposee_keyDown()

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

Definition at line 222 of file nexposee.qc.

223 {
224 float nexposeeKey = 0;
225 if (me.animationState == 2)
226 if (SUPER(Nexposee).keyDown(me, scan, ascii, shift)) return 1;
227 if (scan == K_TAB)
228 {
229 if (me.animationState == 0)
230 {
231 if (shift & S_SHIFT)
232 {
233 if (me.selectedChild) me.selectedChild = me.selectedChild.prevSibling;
234 if (!me.selectedChild) me.selectedChild = me.lastChild;
235 }
236 else
237 {
238 if (me.selectedChild) me.selectedChild = me.selectedChild.nextSibling;
239 if (!me.selectedChild) me.selectedChild = me.firstChild;
240 }
241 }
242 }
243 switch (me.animationState)
244 {
245 default:
246 case 0:
247 case 3:
248 nexposeeKey = ((scan == K_SPACE) || (scan == K_ENTER) || (scan == K_KP_ENTER));
249 break;
250 case 1:
251 case 2:
252 nexposeeKey = (scan == K_ESCAPE);
253 break;
254 }
255 if (nexposeeKey)
256 {
257 switch (me.animationState)
258 {
259 default:
260 case 0:
261 case 3:
263 me.animationState = 1;
264 break;
265 case 1:
266 case 2:
268 me.animationState = 3;
269 break;
270 }
271 if (me.focusedChild) me.selectedChild = me.focusedChild;
272 if (!me.selectedChild) me.animationState = 0;
273 SUPER(Nexposee).setFocus(me, NULL);
274 return 1;
275 }
276 return 0;
277 }
const int S_SHIFT
Definition hud.qh:129
float K_SPACE
Definition keycodes.qc:10
float K_ENTER
Definition keycodes.qc:8
float K_KP_ENTER
Definition keycodes.qc:74
float K_TAB
Definition keycodes.qc:7
float K_ESCAPE
Definition keycodes.qc:9
void m_play_click_sound(string soundfile)
Definition menu.qc:1106
const string MENU_SOUND_CLOSE
Definition menu.qh:50
const string MENU_SOUND_OPEN
Definition menu.qh:53

References entity(), K_ENTER, K_ESCAPE, K_KP_ENTER, K_SPACE, K_TAB, m_play_click_sound(), MENU_SOUND_CLOSE, MENU_SOUND_OPEN, NULL, S_SHIFT, and SUPER.

◆ Nexposee_keyUp()

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

Definition at line 216 of file nexposee.qc.

217 {
218 if (me.animationState == 2) return SUPER(Nexposee).keyUp(me, scan, ascii, shift);
219 return 0;
220 }

References entity(), and SUPER.

◆ Nexposee_mouseDrag()

float Nexposee_mouseDrag ( entity me,
vector pos )

Definition at line 194 of file nexposee.qc.

195 {
196 if (me.animationState == 2) return SUPER(Nexposee).mouseDrag(me, pos);
197 return 0;
198 }

References entity(), SUPER, and vector.

◆ Nexposee_mouseMove()

float Nexposee_mouseMove ( entity me,
vector pos )

Definition at line 200 of file nexposee.qc.

201 {
202 entity e;
203 me.mousePosition = pos;
204 e = me.mouseFocusedChild;
205 me.mouseFocusedChild = me.itemFromPoint(me, pos);
206 if (me.animationState == 2) return SUPER(Nexposee).mouseMove(me, pos);
207 if (me.animationState == 0)
208 {
209 if (me.mouseFocusedChild)
210 if (me.mouseFocusedChild != e || me.mouseFocusedChild != me.selectedChild) me.selectedChild = me.mouseFocusedChild;
211 return 1;
212 }
213 return 0;
214 }

References entity(), SUPER, and vector.

Referenced by Nexposee::mousePress().

◆ Nexposee_mouseRelease()

float Nexposee_mouseRelease ( entity me,
vector pos )

Definition at line 188 of file nexposee.qc.

189 {
190 if (me.animationState == 2) return SUPER(Nexposee).mouseRelease(me, pos);
191 return 0;
192 }

References entity(), SUPER, and vector.

◆ Nexposee_pullNexposee()

void Nexposee_pullNexposee ( entity me,
entity other,
vector theAlign )

Definition at line 294 of file nexposee.qc.

295 {
296 other.Nexposee_align = theAlign;
297 }

References entity(), other, and vector.

◆ Nexposee_resizeNotify()

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

Definition at line 15 of file nexposee.qc.

16 {
17 me.calc(me);
18 me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Nexposee_initialOrigin, Nexposee_initialSize, Nexposee_initialFontScale);
19 }
vector Nexposee_initialSize
Definition nexposee.qh:35
vector Nexposee_initialFontScale
Definition nexposee.qh:36
vector Nexposee_initialOrigin
Definition nexposee.qh:37

References entity(), Nexposee_initialFontScale, Nexposee_initialOrigin, Nexposee_initialSize, and vector.

◆ Nexposee_setNexposee()

void Nexposee_setNexposee ( entity me,
entity other,
vector scalecenter,
float a0,
float a1 )

Definition at line 78 of file nexposee.qc.

79 {
80 other.Nexposee_scaleCenter = scalecenter;
81 other.Nexposee_smallAlpha = a0;
82 me.setAlphaOf(me, other, a0);
83 other.Nexposee_mediumAlpha = a1;
84 }

References entity(), other, and vector.