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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
#ifndef INTERFACE_H
#define INTERFACE_H
#include <SDL/SDL.h>
#if (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
#include <SDL/SDL_syswm.h>
#endif
#include "graphics.h"
struct menu_section
{
char *icon;
const char *name;
int itemcount;
int doshow;
};
typedef struct menu_section menu_section;
#define QM_TOGGLE 1
struct quick_option
{
char *icon;
const char *name;
int type;
int *variable;
};
typedef struct quick_option quick_option;
struct menu_wall
{
pixel colour;
const char *descs;
};
typedef struct menu_wall menu_wall;
#define SC_WALL 0
#define SC_ELEC 1
#define SC_POWERED 2
#define SC_FORCE 3
#define SC_EXPLOSIVE 4
#define SC_GAS 5
#define SC_LIQUID 6
#define SC_POWDERS 7
#define SC_SOLIDS 8
#define SC_NUCLEAR 9
#define SC_SPECIAL 10
#define SC_LIFE 11
#define SC_TOOL 12
#define SC_CRACKER 13
#define SC_CRACKER2 14
#define SC_TOTAL 13
static menu_section msections[] = //doshow does not do anything currently.
{
{"\xC1", "Walls", 0, 1},
{"\xC2", "Electronics", 0, 1},
{"\xD6", "Powered Materials", 0, 1},
{"\xE2", "Force Creating", 0, 1},
{"\xC3", "Explosives", 0, 1},
{"\xC5", "Gasses", 0, 1},
{"\xC4", "Liquids", 0, 1},
{"\xD0", "Powders", 0, 1},
{"\xD1", "Solids", 0, 1},
{"\xC6", "Radioactive", 0, 1},
{"\xCC", "Special", 0, 1},
{"\xD2", "Life", 0, 1},
{"\xD7", "Tools", 0, 1},
{"\xD2", "More Life", 0, 1},
{"\xC8", "", 0, 0},
{"\xC8", "Cracker", 0, 0},
{"\xC8", "Cracker!", 0, 0},
};
static quick_option quickmenu[] =
{
{"P", "Sand effect", QM_TOGGLE, &pretty_powder},
{"G", "Draw gravity grid", QM_TOGGLE, &drawgrav_enable},
{"D", "Show decorations", QM_TOGGLE, &decorations_enable},
{"N", "Newtonian gravity", QM_TOGGLE, &ngrav_enable},
{"A", "Ambient heat", QM_TOGGLE, &aheat_enable},
{NULL}
};
static menu_section colorsections[] = //doshow does not do anything currently.
{
{"\xC4", "Colors", 7, 1},
{"\xD7", "Tools", 0, 1},
};
#define DECO_SECTIONS 2
static menu_wall colorlist[] =
{
{PIXPACK(0xFF0000), "Red"},
{PIXPACK(0x00FF00), "Green"},
{PIXPACK(0x0000FF), "Blue"},
{PIXPACK(0xFFFF00), "Yellow"},
{PIXPACK(0xFF00FF), "Pink"},
{PIXPACK(0x00FFFF), "Cyan"},
{PIXPACK(0xFFFFFF), "White"},
};
#define DECO_DRAW 0
#define DECO_LIGHTEN 1
#define DECO_DARKEN 2
#define DECO_SMUDGE 3
static menu_wall toollist[] =
{
{PIXPACK(0xFF0000), "Draw"},
{PIXPACK(0xDDDDDD), "Lighten"},
{PIXPACK(0x111111), "Darken"},
{PIXPACK(0x00FF00), "Smudge"},
};
struct ui_edit
{
int x, y, w, nx, h;
char str[256],*def;
int focus, cursor, hide, multiline;
};
typedef struct ui_edit ui_edit;
struct ui_list
{
int x, y, w, h;
char str[256],*def,**items;
int selected, focus, count;
};
typedef struct ui_list ui_list;
struct ui_copytext
{
int x, y, width, height;
char text[256];
int state, hover;
};
typedef struct ui_copytext ui_copytext;
struct save_info
{
char *title;
char *name;
char *author;
char *date;
char *description;
int publish;
int voteup;
int votedown;
int vote;
int myvote;
int downloadcount;
int myfav;
char *tags;
int comment_count;
char *comments[6];
char *commentauthors[6];
};
typedef struct save_info save_info;
struct ui_checkbox
{
int x, y;
int focus, checked;
};
typedef struct ui_checkbox ui_checkbox;
struct ui_richtext
{
int x, y;
char str[512];
char printstr[512];
int regionss[6];
int regionsf[6];
char action[6];
char actiondata[6][256];
char actiontext[6][256];
};
typedef struct ui_richtext ui_richtext;
int SLALT;
extern SDLMod sdl_mod;
extern int sdl_key, sdl_rkey, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig;
#if (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
extern SDL_SysWMinfo sdl_wminfo;
extern Atom XA_CLIPBOARD, XA_TARGETS;
#endif
extern char *shift_0;
extern char *shift_1;
extern int svf_messages;
extern int svf_login;
extern int svf_admin;
extern int svf_mod;
extern char svf_user[64];
extern char svf_pass[64];
extern char svf_user_id[64];
extern char svf_session_id[64];
extern char svf_filename[255];
extern int svf_fileopen;
extern int svf_open;
extern int svf_own;
extern int svf_myvote;
extern int svf_publish;
extern char svf_id[16];
extern char svf_name[64];
extern char svf_tags[256];
extern char svf_description[255];
extern void *svf_last;
extern int svf_lsize;
extern char *search_ids[GRID_X*GRID_Y];
extern char *search_dates[GRID_X*GRID_Y];
extern int search_votes[GRID_X*GRID_Y];
extern int search_publish[GRID_X*GRID_Y];
extern int search_scoredown[GRID_X*GRID_Y];
extern int search_scoreup[GRID_X*GRID_Y];
extern char *search_names[GRID_X*GRID_Y];
extern char *search_owners[GRID_X*GRID_Y];
extern void *search_thumbs[GRID_X*GRID_Y];
extern int search_thsizes[GRID_X*GRID_Y];
extern int search_own;
extern int search_fav;
extern int search_date;
extern int search_page;
extern char search_expr[256];
extern char *tag_names[TAG_MAX];
extern int tag_votes[TAG_MAX];
extern int zoom_en;
extern int zoom_x, zoom_y;
extern int zoom_wx, zoom_wy;
void menu_count(void);
void quickoptions_menu(pixel *vid_buf, int b, int bq, int x, int y);
void prop_edit_ui(pixel *vid_buf, int x, int y);
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);
void add_sign_ui(pixel *vid_buf, int mx, int my);
void ui_edit_draw(pixel *vid_buf, ui_edit *ed);
void ui_edit_process(int mx, int my, int mb, ui_edit *ed);
void ui_list_draw(pixel *vid_buf, ui_list *ed);
void ui_list_process(pixel * vid_buf, int mx, int my, int mb, ui_list *ed);
void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed);
void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed);
void ui_copytext_draw(pixel *vid_buf, ui_copytext *ed);
void ui_copytext_process(int mx, int my, int mb, int mbq, ui_copytext *ed);
void ui_richtext_draw(pixel *vid_buf, ui_richtext *ed);
void ui_richtext_settext(char *text, ui_richtext *ed);
void ui_richtext_process(int mx, int my, int mb, int mbq, ui_richtext *ed);
void draw_svf_ui(pixel *vid_buf, int alternate);
void error_ui(pixel *vid_buf, int err, char *txt);
void info_ui(pixel *vid_buf, char *top, char *txt);
void copytext_ui(pixel *vid_buf, char *top, char *txt, char *copytxt);
void info_box(pixel *vid_buf, char *msg);
char *input_ui(pixel *vid_buf, char *title, char *prompt, char *text, char *shadow);
int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn);
void login_ui(pixel *vid_buf);
int stamp_ui(pixel *vid_buf);
void tag_list_ui(pixel *vid_buf);
int save_name_ui(pixel *vid_buf);
int save_filename_ui(pixel *vid_buf);
void menu_ui(pixel *vid_buf, int i, int *sl, int *sr);
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *su, int *dae, int b, int bq, int mx, int my);
int color_menu_ui(pixel *vid_buf, int i, int *cr, int *cg, int *cb, int b, int bq, int mx, int my, int * tool);
int sdl_poll(void);
void set_cmode(int cm);
char *download_ui(pixel *vid_buf, char *uri, int *len);
int search_ui(pixel *vid_buf);
int open_ui(pixel *vid_buf, char *save_id, char *save_date);
void catalogue_ui(pixel * vid_buf);
int info_parse(char *info_data, save_info *info);
int search_results(char *str, int votes);
int execute_tagop(pixel *vid_buf, char *op, char *tag);
void execute_save(pixel *vid_buf);
int execute_delete(pixel *vid_buf, char *id);
int execute_report(pixel *vid_buf, char *id, char *reason);
void execute_submit(pixel *vid_buf, char *id, char *message);
void execute_fav(pixel *vid_buf, char *id);
void execute_unfav(pixel *vid_buf, char *id);
int execute_vote(pixel *vid_buf, char *id, char *action);
void open_link(char *uri);
int report_ui(pixel *vid_buf, char *save_id);
char *console_ui(pixel *vid_buf, char error[255],char console_more);
void render_ui(pixel *vid_buf, int xcoord, int ycoord, int orientation);
void simulation_ui(pixel *vid_buf);
unsigned int decorations_ui(pixel *vid_buf, int *bsx, int *bsy, unsigned int savedColor);
#endif
|