xref hl optimization
This commit is contained in:
parent
a9c1df935d
commit
e915bc5842
|
@ -1518,21 +1518,19 @@ int game_highlight(int x, int y, int on)
|
||||||
struct el *elem = NULL;
|
struct el *elem = NULL;
|
||||||
static struct el *oel = NULL;
|
static struct el *oel = NULL;
|
||||||
static xref_t hxref = NULL;
|
static xref_t hxref = NULL;
|
||||||
xref_t xref = NULL;
|
xref_t xref = NULL;
|
||||||
int up = 0;
|
|
||||||
if (on) {
|
if (on) {
|
||||||
xref = look_xref(x, y, &elem);
|
xref = look_xref(x, y, &elem);
|
||||||
if (xref && opt_hl) {
|
if (xref && opt_hl && !xref_get_active(xref)) {
|
||||||
xref_set_active(xref, 1);
|
xref_set_active(xref, 1);
|
||||||
game_xref_update(xref, elem->x, elem->y);
|
game_xref_update(xref, elem->x, elem->y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hxref != xref && oel) {
|
if (hxref != xref && oel) {
|
||||||
if (hxref != use_xref) {
|
if (hxref != use_xref && xref_get_active(hxref)) {
|
||||||
xref_set_active(hxref, 0);
|
xref_set_active(hxref, 0);
|
||||||
game_xref_update(hxref, oel->x, oel->y);
|
game_xref_update(hxref, oel->x, oel->y);
|
||||||
up = 1;
|
|
||||||
}
|
}
|
||||||
hxref = NULL;
|
hxref = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2626,6 +2626,14 @@ void xref_set_active(xref_t x, int val)
|
||||||
xref->active = val;
|
xref->active = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int xref_get_active(xref_t x)
|
||||||
|
{
|
||||||
|
struct xref *xref = (struct xref*)x;
|
||||||
|
if (!xref)
|
||||||
|
return 0;
|
||||||
|
return xref->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
layout_t txt_layout(fnt_t fn, int align, int width, int height)
|
layout_t txt_layout(fnt_t fn, int align, int width, int height)
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,6 +118,7 @@ extern img_t txt_box_render(textbox_t tbox);
|
||||||
|
|
||||||
extern char *xref_get_text(xref_t x);
|
extern char *xref_get_text(xref_t x);
|
||||||
extern void xref_set_active(xref_t x, int val);
|
extern void xref_set_active(xref_t x, int val);
|
||||||
|
extern int xref_get_active(xref_t x);
|
||||||
|
|
||||||
extern xref_t xref_next(xref_t x);
|
extern xref_t xref_next(xref_t x);
|
||||||
extern xref_t xref_prev(xref_t x);
|
extern xref_t xref_prev(xref_t x);
|
||||||
|
|
Reference in a new issue