fixed some of the menu stuff
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3989 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
24e5adeb2b
commit
61061c8e71
3 changed files with 158 additions and 76 deletions
|
@ -41,8 +41,8 @@ void() spline_init =
|
||||||
if (splinefile < 0)
|
if (splinefile < 0)
|
||||||
{
|
{
|
||||||
/*too lazy to create a file, just use it as a malloc*/
|
/*too lazy to create a file, just use it as a malloc*/
|
||||||
splinefile = fopen("", FILE_MMAP_RW, sizeof(camdata_t));
|
|
||||||
}
|
}
|
||||||
|
splinefile = fopen("", FILE_MMAP_RW, sizeof(camdata_t));
|
||||||
|
|
||||||
camdata = (camdata_t*)(fgets(splinefile));
|
camdata = (camdata_t*)(fgets(splinefile));
|
||||||
};
|
};
|
||||||
|
@ -120,7 +120,7 @@ void(vector p1, vector p2, vector color) fakeline = {
|
||||||
R_EndPolygon();
|
R_EndPolygon();
|
||||||
};
|
};
|
||||||
|
|
||||||
void (vector p1, vector p2, float size, vector color) fakeline_new
|
void (vector p1, vector p2, float linesize, vector color) fakeline_new
|
||||||
{
|
{
|
||||||
local vector diff;
|
local vector diff;
|
||||||
|
|
||||||
|
@ -128,34 +128,34 @@ void (vector p1, vector p2, float size, vector color) fakeline_new
|
||||||
normalize(diff);
|
normalize(diff);
|
||||||
};
|
};
|
||||||
|
|
||||||
void (vector pos, float size, vector color) draw_point
|
void (vector pos, float point_size, vector color) draw_point
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local vector offsets[5];
|
local vector offsets[5];
|
||||||
local vector points[8];
|
local vector points[8];
|
||||||
local vector point, point1;
|
local vector point, point1;
|
||||||
|
|
||||||
if (size == 0)
|
if (point_size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
point_x = -(size/2);
|
point_x = -(point_size/2);
|
||||||
point_y = -(size/2);
|
point_y = -(point_size/2);
|
||||||
offsets[0] = point;
|
offsets[0] = point;
|
||||||
point_x = size/2;
|
point_x = point_size/2;
|
||||||
point_y = -(size/2);
|
point_y = -(point_size/2);
|
||||||
offsets[1] = point;
|
offsets[1] = point;
|
||||||
point_x = -(size/2);
|
point_x = -(point_size/2);
|
||||||
point_y = (size/2);
|
point_y = (point_size/2);
|
||||||
offsets[2] = point;
|
offsets[2] = point;
|
||||||
point_x = (size/2);
|
point_x = (point_size/2);
|
||||||
point_y = (size/2);
|
point_y = (point_size/2);
|
||||||
offsets[3] = point;
|
offsets[3] = point;
|
||||||
|
|
||||||
point1_z = -(size/2);
|
point1_z = -(point_size/2);
|
||||||
for (i=0; i<4; i++)
|
for (i=0; i<4; i++)
|
||||||
points[i] = offsets[i] + point1 + pos;
|
points[i] = offsets[i] + point1 + pos;
|
||||||
|
|
||||||
point1_z = (size/2);
|
point1_z = (point_size/2);
|
||||||
for (i=4; i<8; i++)
|
for (i=4; i<8; i++)
|
||||||
points[i] = offsets[i-4] + point1 + pos;
|
points[i] = offsets[i-4] + point1 + pos;
|
||||||
|
|
||||||
|
@ -216,15 +216,6 @@ void (vector pos, float size, vector color) draw_point
|
||||||
R_PolygonVertex(points[3], '1 1', color,1);
|
R_PolygonVertex(points[3], '1 1', color,1);
|
||||||
R_PolygonVertex(points[1], '1 0', color,1);
|
R_PolygonVertex(points[1], '1 0', color,1);
|
||||||
R_EndPolygon();
|
R_EndPolygon();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// time has to be between 0 and 1
|
// time has to be between 0 and 1
|
||||||
|
@ -402,6 +393,11 @@ void(float attime) spline_overrides =
|
||||||
local float stime;
|
local float stime;
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
|
print(sprintf("cd pc: %i\n", camdata->position_count));
|
||||||
|
|
||||||
|
if (camdata->position_count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i=0; i < camdata->position_count; i++)
|
for (i=0; i < camdata->position_count; i++)
|
||||||
{
|
{
|
||||||
cpos = &camdata->position[i];
|
cpos = &camdata->position[i];
|
||||||
|
@ -469,8 +465,8 @@ void() editor_spline_add =
|
||||||
local vector tdir;
|
local vector tdir;
|
||||||
tdir_x = 16 * cos(time);
|
tdir_x = 16 * cos(time);
|
||||||
tdir_y = 16 * sin(time);
|
tdir_y = 16 * sin(time);
|
||||||
drawlame3dtext("charset", tdir*(-33/2), tdir, '0 0 -16', "hello jogi\ndoes this string appear for you?", '1 1 1', 1);
|
// drawlame3dtext("charset", '300 -500 50', tdir, '0 0 -16', "hello jogi\ndoes this string appear for you?", '1 1 1', 1);
|
||||||
drawlame3dtext("charset", tdir*(33/2), -tdir, '0 0 -16', "hello jogi\ndoes this string appear for you?", '1 1 1', 1);
|
// drawlame3dtext("charset", '300 -500 50', -tdir, '0 0 -16', "hello jogi\ndoes this string appear for you?", '1 1 1', 1);
|
||||||
|
|
||||||
if (splinefile < 0)
|
if (splinefile < 0)
|
||||||
spline_init();
|
spline_init();
|
||||||
|
@ -492,9 +488,10 @@ static menu_t menu;
|
||||||
|
|
||||||
int (vector *curmousepos, vector mousediff, float key) submenu =
|
int (vector *curmousepos, vector mousediff, float key) submenu =
|
||||||
{
|
{
|
||||||
local vector pos;
|
local vector pos, cpos;
|
||||||
local spline_t *s;
|
local spline_t *s;
|
||||||
local vector point;
|
local vector point;
|
||||||
|
string str;
|
||||||
|
|
||||||
pos = submenu_position;
|
pos = submenu_position;
|
||||||
|
|
||||||
|
@ -506,21 +503,50 @@ int (vector *curmousepos, vector mousediff, float key) submenu =
|
||||||
s = &camdata.position[camdata.position_selected].spline;
|
s = &camdata.position[camdata.position_selected].spline;
|
||||||
else
|
else
|
||||||
s = &camdata.view[camdata.view_selected].spline;
|
s = &camdata.view[camdata.view_selected].spline;
|
||||||
|
|
||||||
|
menu->flags = MF_DS_VALUE;
|
||||||
|
if (edit_type == 0)
|
||||||
|
{
|
||||||
|
if (camdata.position_count > 1)
|
||||||
|
{
|
||||||
|
str = sprintf("%2i/%2i", camdata.position_selected+1i, camdata.position_count);
|
||||||
|
cpos = pos;
|
||||||
|
cpos_x = strlen(str) * 8 +4;
|
||||||
|
drawrawstring(pos, str, '8 8 0', '1 0 0', 1);
|
||||||
|
slideri_widgit(&menu, "", cpos, &camdata.position_selected, 0, camdata.position_count-1i);
|
||||||
|
pos_y += 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (camdata.view_count > 1)
|
||||||
|
{
|
||||||
|
str = sprintf("%2i/%2i", camdata.view_selected+1i, camdata.view_count);
|
||||||
|
cpos = pos;
|
||||||
|
cpos_x = strlen(str) * 8 +4;
|
||||||
|
drawrawstring(pos, str, '8 8 0', '1 0 0', 1);
|
||||||
|
slideri_widgit(&menu, "", cpos, &camdata.view_selected, 0, camdata.view_count);
|
||||||
|
pos_y += 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menu->flags = 0;
|
||||||
|
|
||||||
|
pos_y += 8;
|
||||||
|
|
||||||
if (s->numpoints > 0)
|
if (s->numpoints > 0)
|
||||||
{
|
{
|
||||||
|
menu->flags = MF_DS_VALUE;
|
||||||
|
slideri_widgit(&menu, sprintf("%2i/%2i", s->selected_point + 1i, s->numpoints), pos, &s->selected_point, 0, s->numpoints - 1i);pos_y+=8;
|
||||||
|
menu->flags = 0;
|
||||||
point = s->pos[s->selected_point];
|
point = s->pos[s->selected_point];
|
||||||
sliderf_fixed_widgit(&menu, "x:", pos, &point_x);pos_y+=8;
|
sliderf_fixed_widgit(&menu, "x:", pos, &point_x);pos_y+=8;
|
||||||
sliderf_fixed_widgit(&menu, "y:", pos, &point_y);pos_y+=8;
|
sliderf_fixed_widgit(&menu, "y:", pos, &point_y);pos_y+=8;
|
||||||
sliderf_fixed_widgit(&menu, "z:", pos, &point_z);pos_y+=8;
|
sliderf_fixed_widgit(&menu, "z:", pos, &point_z);pos_y+=8;
|
||||||
s->pos[s->selected_point] = point;
|
s->pos[s->selected_point] = point;
|
||||||
|
menu->flags = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the widgets have to handle mouse properly
|
|
||||||
* if mousedown == 1 && curslider == self -> return
|
|
||||||
*/
|
|
||||||
int (vector *curmousepos, vector mousediff, float key) testmenu =
|
int (vector *curmousepos, vector mousediff, float key) testmenu =
|
||||||
{
|
{
|
||||||
local vector pos;
|
local vector pos;
|
||||||
|
@ -545,6 +571,7 @@ int (vector *curmousepos, vector mousediff) editor_spline_overlay =
|
||||||
local vector pos, v;
|
local vector pos, v;
|
||||||
local spline_t *s;
|
local spline_t *s;
|
||||||
local int ri;
|
local int ri;
|
||||||
|
local string str;
|
||||||
|
|
||||||
if (splinefile < 0)
|
if (splinefile < 0)
|
||||||
spline_init();
|
spline_init();
|
||||||
|
@ -553,31 +580,26 @@ int (vector *curmousepos, vector mousediff) editor_spline_overlay =
|
||||||
/*draw menu*/
|
/*draw menu*/
|
||||||
/*dunno if the light editor has any convienient code*/
|
/*dunno if the light editor has any convienient code*/
|
||||||
pos_y = 40;
|
pos_y = 40;
|
||||||
|
str = sprintf("cam(%i)", camdata->position_count);
|
||||||
if (edit_type == 0)
|
if (edit_type == 0)
|
||||||
drawrawstring(pos, "cam", '8 8 0', '1 0 0', 1);
|
drawrawstring(pos, str, '8 8 0', '1 0 0', 1);
|
||||||
else
|
else
|
||||||
drawrawstring(pos, "cam", '8 8 0', '1 1 1', 1);
|
drawrawstring(pos, str, '8 8 0', '1 1 1', 1);
|
||||||
drawrawstring(pos + '24 0 0', sprintf(" : %i / %i", camdata->position_selected + 1i , camdata->position_count), '8 8 0', '1 1 1', 1);
|
v = pos;
|
||||||
if (camdata->position_count)
|
v_x += strlen(str) * 8;
|
||||||
{
|
ri = strlen(str) + 1;
|
||||||
pos_y += 8;
|
drawrawstring(v , "/", '8 8 0', '1 1 1', 1);
|
||||||
s = &camdata->position[camdata->position_selected].spline;
|
v_x += 8;
|
||||||
v = s->pos[s->selected_point];
|
str = sprintf("view(%i)", camdata->view_count);
|
||||||
drawrawstring(pos, sprintf(" point: %i / %i -- %f %f %f", s->selected_point + 1i, s->numpoints, v_x, v_y, v_z), '8 8 0', '1 1 1', 1);
|
|
||||||
}
|
|
||||||
pos_y += 8;
|
|
||||||
if (edit_type == 1)
|
if (edit_type == 1)
|
||||||
drawrawstring(pos, "view", '8 8 0', '1 0 0', 1);
|
drawrawstring(v, str, '8 8 0', '1 0 0', 1);
|
||||||
else
|
else
|
||||||
drawrawstring(pos, "view", '8 8 0', '1 1 1', 1);
|
drawrawstring(v, str, '8 8 0', '1 1 1', 1);
|
||||||
drawrawstring(pos + '32 0 0', sprintf(" : %i / %i", camdata->view_selected + 1i, camdata->view_count), '8 8 0', '1 1 1', 1);
|
ri += strlen(str) + 1i;
|
||||||
if (camdata->view_count)
|
v_x += 4 + strlen(str) * 8;
|
||||||
{
|
|
||||||
pos_y += 8;
|
menu->flags = MF_DS_VALUE;
|
||||||
s = &camdata->view[camdata->view_selected].spline;
|
checkboxi_widgit(&menu, "", v, &edit_type);
|
||||||
v = s->pos[s->selected_point];
|
|
||||||
drawrawstring(pos, sprintf(" point: %i / %i -- %f %f %f", s->selected_point + 1i, s->numpoints, v_x, v_y, v_z), '8 8 0', '1 1 1', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
submenu_position = pos + '0 8';
|
submenu_position = pos + '0 8';
|
||||||
|
|
||||||
|
@ -655,14 +677,11 @@ void (int type) view_add_point =
|
||||||
|
|
||||||
void(void) position_add
|
void(void) position_add
|
||||||
{
|
{
|
||||||
print(sprintf("test\n"));
|
|
||||||
if (camdata->position_count >= 64)
|
if (camdata->position_count >= 64)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
print(sprintf("adding a position\n"));
|
|
||||||
|
|
||||||
camdata->position_selected = camdata->position_count;
|
camdata->position_selected = camdata->position_count;
|
||||||
camdata->position_count = camdata->position_count + 1i; //oldskool
|
camdata->position_count = camdata->position_count + 1i; //oldskool
|
||||||
}
|
}
|
||||||
|
@ -958,6 +977,15 @@ float(float keycode, float unicode, vector *curmousepos_in, vector mousediff) ed
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keycode == 'n')
|
||||||
|
{
|
||||||
|
if (edit_type == 0)
|
||||||
|
position_add();
|
||||||
|
else
|
||||||
|
view_add();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
submenu(curmousepos_in, mousediff, keycode);
|
submenu(curmousepos_in, mousediff, keycode);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
../csaddon.dat
|
../csprogs.dat
|
||||||
//pr_dumpplatform -FFTE -Fdefines -TCS -O csplat
|
//pr_dumpplatform -FFTE -Fdefines -TCS -O csplat
|
||||||
opts.qc
|
opts.qc
|
||||||
csplat.qc
|
csplat.qc
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
|
#define MF_DS_VALUE (1i << 0i)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float *current;
|
float *current;
|
||||||
float key;
|
float key;
|
||||||
vector *mousepos;
|
vector *mousepos;
|
||||||
vector mousediff;
|
vector mousediff;
|
||||||
|
int flags;
|
||||||
} menu_t;
|
} menu_t;
|
||||||
|
|
||||||
|
int (vector topleft, vector bottomright, vector cursor) cursor_in_widget
|
||||||
|
{
|
||||||
|
if (cursor_x <= bottomright_x && cursor_x >= topleft_x)
|
||||||
|
if (cursor_y <= bottomright_y && cursor_y >= topleft_y)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float maxv) sliderf_widgit =
|
void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float maxv) sliderf_widgit =
|
||||||
{
|
{
|
||||||
local vector rpos, spos, col;
|
local vector rpos, spos, col;
|
||||||
|
@ -14,7 +25,6 @@ void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float
|
||||||
local vector mousepos = *menu->mousepos;
|
local vector mousepos = *menu->mousepos;
|
||||||
local vector mp = *menu->mousepos;
|
local vector mp = *menu->mousepos;
|
||||||
local vector mousediff = menu->mousediff;
|
local vector mousediff = menu->mousediff;
|
||||||
local int draw_value = 1; // 8 parameter limit?
|
|
||||||
local float key = menu->key;
|
local float key = menu->key;
|
||||||
|
|
||||||
render_only = 0;
|
render_only = 0;
|
||||||
|
@ -61,10 +71,8 @@ void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float
|
||||||
f = maxv;
|
f = maxv;
|
||||||
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
||||||
drawstring(spos, "^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", '8 8 0', '1 1 1', 1, 0);
|
drawstring(spos, "^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", '8 8 0', '1 1 1', 1, 0);
|
||||||
if (draw_value == 1)
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
{
|
|
||||||
drawstring(spos + '88 0', ftos(f), '8 8 0', col, 1, 0);
|
drawstring(spos + '88 0', ftos(f), '8 8 0', col, 1, 0);
|
||||||
}
|
|
||||||
spos_x += 9*8*(f - minv) / (maxv - minv);
|
spos_x += 9*8*(f - minv) / (maxv - minv);
|
||||||
drawstring(spos, "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
drawstring(spos, "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
||||||
}
|
}
|
||||||
|
@ -86,26 +94,24 @@ void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float
|
||||||
|
|
||||||
void(menu_t *menu, string fieldname, vector pos, float *value) sliderf_fixed_widgit =
|
void(menu_t *menu, string fieldname, vector pos, float *value) sliderf_fixed_widgit =
|
||||||
{
|
{
|
||||||
local vector rpos, spos, col;
|
local vector rpos, spos, epos, col;
|
||||||
local float f;
|
local float f;
|
||||||
local int render_only;
|
local int render_only = 0;
|
||||||
local vector mousepos = *menu->mousepos;
|
local vector mousepos = *menu->mousepos;
|
||||||
local vector mp = *menu->mousepos;
|
local vector mp = *menu->mousepos;
|
||||||
local vector mousediff = menu->mousediff;
|
local vector mousediff = menu->mousediff;
|
||||||
local vector *mpp = menu->mousepos;
|
local vector *mpp = menu->mousepos;
|
||||||
local int draw_value = 1; // 8 parameter limit?
|
|
||||||
local float key = menu->key;
|
local float key = menu->key;
|
||||||
|
|
||||||
render_only = 0;
|
|
||||||
|
|
||||||
rpos = pos;
|
rpos = pos;
|
||||||
spos = rpos;
|
spos = rpos;
|
||||||
spos_x = pos_x + strlen(fieldname) * 8 + 4;
|
spos_x = pos_x + strlen(fieldname) * 8 + 4;
|
||||||
|
epos = spos + '20 8';
|
||||||
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
|
epos_x += strlen(sprintf("%f", *value)) * 8;
|
||||||
/*if they're dragging us, update*/
|
/*if they're dragging us, update*/
|
||||||
//print(sprintf("%i %i\n", (int) menu->current, (int) value));
|
|
||||||
if ((int)menu->current == (int)value)
|
if ((int)menu->current == (int)value)
|
||||||
{
|
{
|
||||||
print(sprintf("mousedown: %i\n", mousedown));
|
|
||||||
if (mousedown == 1)
|
if (mousedown == 1)
|
||||||
{
|
{
|
||||||
*value = *value + mousediff_x/10;
|
*value = *value + mousediff_x/10;
|
||||||
|
@ -125,7 +131,7 @@ void(menu_t *menu, string fieldname, vector pos, float *value) sliderf_fixed_wid
|
||||||
|
|
||||||
if (key == -1 || render_only == 1 )
|
if (key == -1 || render_only == 1 )
|
||||||
{
|
{
|
||||||
if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0)
|
if (cursor_in_widget(pos, epos, mousepos) && render_only == 0)
|
||||||
{
|
{
|
||||||
col_x = (sin(time*3.14)+1) / 2;
|
col_x = (sin(time*3.14)+1) / 2;
|
||||||
col_y = col_x;
|
col_y = col_x;
|
||||||
|
@ -138,7 +144,7 @@ void(menu_t *menu, string fieldname, vector pos, float *value) sliderf_fixed_wid
|
||||||
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
||||||
|
|
||||||
drawstring(spos, "^Ue080^Ue082", '8 8 0', '1 1 1', 1, 0);
|
drawstring(spos, "^Ue080^Ue082", '8 8 0', '1 1 1', 1, 0);
|
||||||
if (draw_value)
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
drawstring(spos + '20 0', ftos(f), '8 8 0', col, 1, 0);
|
drawstring(spos + '20 0', ftos(f), '8 8 0', col, 1, 0);
|
||||||
drawstring(spos + '4 0', "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
drawstring(spos + '4 0', "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
||||||
}
|
}
|
||||||
|
@ -161,13 +167,12 @@ void(menu_t *menu, string fieldname, vector pos, float *value) sliderf_fixed_wid
|
||||||
|
|
||||||
void(menu_t *menu, string fieldname, vector pos, int *value, int minv, int maxv) slideri_widgit =
|
void(menu_t *menu, string fieldname, vector pos, int *value, int minv, int maxv) slideri_widgit =
|
||||||
{
|
{
|
||||||
local vector rpos, spos, col;
|
local vector rpos, spos, epos, col;
|
||||||
local int f;
|
local int f;
|
||||||
local int render_only;
|
local int render_only;
|
||||||
local vector mousepos = *menu->mousepos;
|
local vector mousepos = *menu->mousepos;
|
||||||
local vector mp = *menu->mousepos;
|
local vector mp = *menu->mousepos;
|
||||||
local vector mousediff = menu->mousediff;
|
local vector mousediff = menu->mousediff;
|
||||||
local int draw_value = 1; // 8 parameter limit?
|
|
||||||
local float key;
|
local float key;
|
||||||
|
|
||||||
key = menu->key;
|
key = menu->key;
|
||||||
|
@ -177,6 +182,9 @@ void(menu_t *menu, string fieldname, vector pos, int *value, int minv, int maxv)
|
||||||
rpos = pos;
|
rpos = pos;
|
||||||
spos = rpos;
|
spos = rpos;
|
||||||
spos_x = pos_x + strlen(fieldname) * 8 + 4;
|
spos_x = pos_x + strlen(fieldname) * 8 + 4;
|
||||||
|
epos = spos + '88 8';
|
||||||
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
|
epos_x = strlen(sprintf("%i", *value)) * 8;
|
||||||
/*if they're dragging us, update*/
|
/*if they're dragging us, update*/
|
||||||
if ((int)menu->current == (int)value)
|
if ((int)menu->current == (int)value)
|
||||||
{
|
{
|
||||||
|
@ -216,10 +224,8 @@ void(menu_t *menu, string fieldname, vector pos, int *value, int minv, int maxv)
|
||||||
f = maxv;
|
f = maxv;
|
||||||
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
||||||
drawstring(spos, "^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", '8 8 0', '1 1 1', 1, 0);
|
drawstring(spos, "^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", '8 8 0', '1 1 1', 1, 0);
|
||||||
if (draw_value == 1)
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
{
|
|
||||||
drawstring(spos + '88 0', ftos(f), '8 8 0', col, 1, 0);
|
drawstring(spos + '88 0', ftos(f), '8 8 0', col, 1, 0);
|
||||||
}
|
|
||||||
spos_x += 9*8*(f - minv) / (maxv - minv);
|
spos_x += 9*8*(f - minv) / (maxv - minv);
|
||||||
drawstring(spos, "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
drawstring(spos, "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
||||||
}
|
}
|
||||||
|
@ -233,9 +239,9 @@ void(menu_t *menu, string fieldname, vector pos, int *value, int minv, int maxv)
|
||||||
*menu->mousepos = mp;
|
*menu->mousepos = mp;
|
||||||
}
|
}
|
||||||
else if (key == 515)
|
else if (key == 515)
|
||||||
*value = bound(minv, *value + (maxv - minv) / 10, maxv);
|
*value = bound(minv, *value + 1i, maxv);
|
||||||
else if (key == 516)
|
else if (key == 516)
|
||||||
*value = bound(minv, *value - (maxv - minv) / 10, maxv);
|
*value = bound(minv, *value - 1i, maxv);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -282,6 +288,54 @@ void(string fieldname, vector pos, vector *mousepos_in, float *value, float key)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void(menu_t *menu, string fieldname, vector pos, int *value) checkboxi_widgit =
|
||||||
|
{
|
||||||
|
local vector rpos, epos, spos, col;
|
||||||
|
local int render_only = 0;
|
||||||
|
local vector mousepos = *menu->mousepos;
|
||||||
|
local vector mousediff = menu->mousediff;
|
||||||
|
local float key = menu->key;
|
||||||
|
|
||||||
|
spos = pos;
|
||||||
|
spos_x += strlen(fieldname) * 8 + 4;
|
||||||
|
epos = spos;
|
||||||
|
epos_x += 16;
|
||||||
|
epos_y += 8;
|
||||||
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
|
epos_x += strlen((*value) ? "TRUE":"FALSE") *8;
|
||||||
|
|
||||||
|
render_only = 0;
|
||||||
|
|
||||||
|
if (key == -1)
|
||||||
|
{
|
||||||
|
if (cursor_in_widget(pos, epos, mousepos) && render_only == 0)
|
||||||
|
{
|
||||||
|
col_x = (sin(time*3.14)+1) / 2;
|
||||||
|
col_y = col_x;
|
||||||
|
col_z = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
col = '1 1 1';
|
||||||
|
|
||||||
|
drawstring(pos, fieldname, '8 8 0', col, 1, 0);
|
||||||
|
drawstring(spos, "^Ue080^Ue082", '8 8 0', '1 1 1', 1, 0);
|
||||||
|
if (!(menu->flags & MF_DS_VALUE))
|
||||||
|
drawstring(spos + '88 0', ((*value) ?"TRUE":"FALSE"), '8 8 0', col, 1, 0);
|
||||||
|
if (*value)
|
||||||
|
drawstring(spos + '4 0', "^Ue083", '8 8 0', '1 1 1', 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cursor_in_widget(pos, epos, mousepos) && key != -1)
|
||||||
|
{
|
||||||
|
if (key == 512)
|
||||||
|
*value = !*value;
|
||||||
|
else if (key == 515)
|
||||||
|
*value = !*value;
|
||||||
|
else if (key == 516)
|
||||||
|
*value = !*value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void(string shader, vector org, vector s, vector t, string text, vector col, float alph) drawlame3dtext =
|
void(string shader, vector org, vector s, vector t, string text, vector col, float alph) drawlame3dtext =
|
||||||
{
|
{
|
||||||
/*the shader must be a 16*16 grid of 256 chars*/
|
/*the shader must be a 16*16 grid of 256 chars*/
|
||||||
|
|
Loading…
Reference in a new issue