1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
//
//
// ui_signup.c
//
#include "ui_local.h"
#define SIGNUP_FRAME "menu/art/cut_frame"
#define ID_NAME 100
#define ID_NAME_BOX 101
#define ID_PASSWORD 102
#define ID_PASSWORD_BOX 103
#define ID_AGAIN 104
#define ID_AGAIN_BOX 105
#define ID_EMAIL 106
#define ID_EMAIL_BOX 107
#define ID_SIGNUP 108
#define ID_CANCEL 109
typedef struct
{
menuframework_s menu;
menubitmap_s frame;
menutext_s name;
menufield_s name_box;
menutext_s password;
menufield_s password_box;
menutext_s again;
menufield_s again_box;
menutext_s email;
menufield_s email_box;
menutext_s signup;
menutext_s cancel;
} signup_t;
static signup_t s_signup;
static menuframework_s s_signup_menu;
static menuaction_s s_signup_signup;
static menuaction_s s_signup_cancel;
static vec4_t s_signup_color_prompt = {1.00, 0.43, 0.00, 1.00};
/*
===============
Signup_MenuEvent
===============
*/
static void Signup_MenuEvent( void* ptr, int event ) {
//char cmd[1024];
if( event != QM_ACTIVATED ) {
return;
}
switch( ((menucommon_s*)ptr)->id ) {
case ID_SIGNUP:
if( strcmp(s_signup.password_box.field.buffer,
s_signup.again_box.field.buffer) != 0 )
{
// GRANK_FIXME - password mismatch
break;
}
// set name
//trap_Cvar_Set( "name", s_signup.name_box.field.buffer );
/*
trap_Cvar_Set( "rank_name", s_signup.name_box.field.buffer );
trap_Cvar_Set( "rank_pwd", s_signup.password_box.field.buffer );
*/
// create account
/*
sprintf( cmd, "cmd rank_create \"%s\" \"%s\" \"%s\"\n",
s_signup.name_box.field.buffer,
s_signup.password_box.field.buffer,
s_signup.email_box.field.buffer );
trap_Cmd_ExecuteText( EXEC_APPEND, cmd );
*/
trap_CL_UI_RankUserCreate(
s_signup.name_box.field.buffer,
s_signup.password_box.field.buffer,
s_signup.email_box.field.buffer );
UI_ForceMenuOff();
break;
case ID_CANCEL:
UI_PopMenu();
break;
}
}
/*
===============
Signup_MenuInit
===============
*/
void Signup_MenuInit( void ) {
grank_status_t status;
int y;
memset( &s_signup, 0, sizeof(s_signup) );
Signup_Cache();
s_signup.menu.wrapAround = qtrue;
s_signup.menu.fullscreen = qfalse;
s_signup.frame.generic.type = MTYPE_BITMAP;
s_signup.frame.generic.flags = QMF_INACTIVE;
s_signup.frame.generic.name = SIGNUP_FRAME;
s_signup.frame.generic.x = 142; //320-233;
s_signup.frame.generic.y = 118; //240-166;
s_signup.frame.width = 359; //466;
s_signup.frame.height = 256; //332;
y = 194;
s_signup.name.generic.type = MTYPE_PTEXT;
s_signup.name.generic.flags = QMF_RIGHT_JUSTIFY|QMF_INACTIVE;
s_signup.name.generic.id = ID_NAME;
s_signup.name.generic.x = 310;
s_signup.name.generic.y = y;
s_signup.name.string = "NAME";
s_signup.name.style = UI_RIGHT|UI_SMALLFONT;
s_signup.name.color = s_signup_color_prompt;
s_signup.name_box.generic.type = MTYPE_FIELD;
s_signup.name_box.generic.ownerdraw = Rankings_DrawName;
s_signup.name_box.generic.name = "";
s_signup.name_box.generic.flags = 0;
s_signup.name_box.generic.x = 330;
s_signup.name_box.generic.y = y;
s_signup.name_box.field.widthInChars = 16;
s_signup.name_box.field.maxchars = 16;
y += 20;
s_signup.password.generic.type = MTYPE_PTEXT;
s_signup.password.generic.flags = QMF_RIGHT_JUSTIFY|QMF_INACTIVE;
s_signup.password.generic.id = ID_PASSWORD;
s_signup.password.generic.x = 310;
s_signup.password.generic.y = y;
s_signup.password.string = "PASSWORD";
s_signup.password.style = UI_RIGHT|UI_SMALLFONT;
s_signup.password.color = s_signup_color_prompt;
s_signup.password_box.generic.type = MTYPE_FIELD;
s_signup.password_box.generic.ownerdraw = Rankings_DrawPassword;
s_signup.password_box.generic.name = "";
s_signup.password_box.generic.flags = 0;
s_signup.password_box.generic.x = 330;
s_signup.password_box.generic.y = y;
s_signup.password_box.field.widthInChars = 16;
s_signup.password_box.field.maxchars = 16;
y += 20;
s_signup.again.generic.type = MTYPE_PTEXT;
s_signup.again.generic.flags = QMF_RIGHT_JUSTIFY|QMF_INACTIVE;
s_signup.again.generic.id = ID_AGAIN;
s_signup.again.generic.x = 310;
s_signup.again.generic.y = y;
s_signup.again.string = "(AGAIN)";
s_signup.again.style = UI_RIGHT|UI_SMALLFONT;
s_signup.again.color = s_signup_color_prompt;
s_signup.again_box.generic.type = MTYPE_FIELD;
s_signup.again_box.generic.ownerdraw = Rankings_DrawPassword;
s_signup.again_box.generic.name = "";
s_signup.again_box.generic.flags = 0;
s_signup.again_box.generic.x = 330;
s_signup.again_box.generic.y = y;
s_signup.again_box.field.widthInChars = 16;
s_signup.again_box.field.maxchars = 16;
y += 20;
s_signup.email.generic.type = MTYPE_PTEXT;
s_signup.email.generic.flags = QMF_RIGHT_JUSTIFY|QMF_INACTIVE;
s_signup.email.generic.id = ID_EMAIL;
s_signup.email.generic.x = 310;
s_signup.email.generic.y = y;
s_signup.email.string = "EMAIL";
s_signup.email.style = UI_RIGHT|UI_SMALLFONT;
s_signup.email.color = s_signup_color_prompt;
s_signup.email_box.generic.type = MTYPE_FIELD;
s_signup.email_box.generic.ownerdraw = Rankings_DrawText;
s_signup.email_box.generic.name = "";
s_signup.email_box.generic.flags = 0;
s_signup.email_box.generic.x = 330;
s_signup.email_box.generic.y = y;
s_signup.email_box.field.widthInChars = 16;
s_signup.email_box.field.maxchars = MAX_EDIT_LINE;
y += 40;
s_signup.signup.generic.type = MTYPE_PTEXT;
s_signup.signup.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
s_signup.signup.generic.id = ID_SIGNUP;
s_signup.signup.generic.callback = Signup_MenuEvent;
s_signup.signup.generic.x = 310;
s_signup.signup.generic.y = y;
s_signup.signup.string = "SIGN UP";
s_signup.signup.style = UI_RIGHT|UI_SMALLFONT;
s_signup.signup.color = colorRed;
s_signup.cancel.generic.type = MTYPE_PTEXT;
s_signup.cancel.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
s_signup.cancel.generic.id = ID_CANCEL;
s_signup.cancel.generic.callback = Signup_MenuEvent;
s_signup.cancel.generic.x = 330;
s_signup.cancel.generic.y = y;
s_signup.cancel.string = "CANCEL";
s_signup.cancel.style = UI_LEFT|UI_SMALLFONT;
s_signup.cancel.color = colorRed;
y += 20;
status = (grank_status_t)trap_Cvar_VariableValue("client_status");
if( (status != QGR_STATUS_NEW) && (status != QGR_STATUS_SPECTATOR) )
{
s_signup.name_box.generic.flags |= QMF_INACTIVE;
s_signup.password_box.generic.flags |= QMF_INACTIVE;
s_signup.again_box.generic.flags |= QMF_INACTIVE;
s_signup.email_box.generic.flags |= QMF_INACTIVE;
s_signup.signup.generic.flags |= QMF_INACTIVE;
s_signup.signup.color = colorMdGrey;
}
Menu_AddItem( &s_signup.menu, (void*) &s_signup.frame );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.name );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.name_box );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.password );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.password_box );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.again );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.again_box );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.email );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.email_box );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.signup );
Menu_AddItem( &s_signup.menu, (void*) &s_signup.cancel );
}
/*
===============
Signup_Cache
===============
*/
void Signup_Cache( void ) {
trap_R_RegisterShaderNoMip( SIGNUP_FRAME );
}
/*
===============
UI_SignupMenu
===============
*/
void UI_SignupMenu( void ) {
Signup_MenuInit();
UI_PushMenu ( &s_signup.menu );
}
|