drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
}
// draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
- const vector cursorsize = '32 32 0';
float cursor_alpha = 1 - autocvar__menu_alpha;
if(!mouse_over_panel)
- drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+ draw_cursor_normal(mousepos, '1 1 1', cursor_alpha);
else if(mouse_over_panel == 1)
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+ draw_cursor(mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
else if(mouse_over_panel == 2)
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+ draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize", '1 1 1', cursor_alpha);
else
- drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
+ draw_cursor(mousepos, '0.5 0.5 0', "/cursor_resize2", '1 1 1', cursor_alpha);
prevMouseClicked = mouseClicked;
}
}
- const vector cursor_size = '32 32 0';
- drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursor_size, '1 1 1', 0.8, DRAWFLAG_NORMAL);
+ draw_cursor_normal(mousepos, '1 1 1', 0.8);
}
void HUD_Radar()
#define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
+void draw_cursor(vector pos, vector ofs, string img, vector col, float a)
+{
+ ofs = eX * (ofs.x * SIZE_CURSOR.x) + eY * (ofs.y * SIZE_CURSOR.y);
+ drawpic(pos - ofs, strcat(draw_currentSkin, img), SIZE_CURSOR, col, a, DRAWFLAG_NORMAL);
+}
+
+void draw_cursor_normal(vector pos, vector col, float a)
+{
+ draw_cursor(pos, OFFSET_CURSOR, "/cursor", col, a);
+}
+
+void LoadMenuSkinValues()
+{
+ int fh = -1;
+ if(cvar_string("menu_skin") != "")
+ {
+ draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
+ fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
+ }
+ if(fh < 0 && cvar_defstring("menu_skin") != "")
+ {
+ cvar_set("menu_skin", cvar_defstring("menu_skin"));
+ draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
+ fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
+ }
+ if(fh < 0)
+ {
+ draw_currentSkin = "gfx/menu/default";
+ fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
+ }
+
+ draw_currentSkin = strzone(draw_currentSkin);
+
+ if(fh >= 0)
+ {
+ string s;
+ while((s = fgets(fh)))
+ {
+ int n = tokenize_console(s);
+ if (n < 2)
+ continue;
+ if(substring(argv(0), 0, 2) == "//")
+ continue;
+ if(argv(0) == "SIZE_CURSOR")
+ SIZE_CURSOR = stov(substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+ else if(argv(0) == "OFFSET_CURSOR")
+ OFFSET_CURSOR = stov(substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+ }
+ fclose(fh);
+ }
+}
+
// CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
// Useful for precaching things
}
hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
-
- int fh = -1;
- if(cvar_string("menu_skin") != "")
- {
- draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
- fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
- }
- if(fh < 0 && cvar_defstring("menu_skin") != "")
- {
- cvar_set("menu_skin", cvar_defstring("menu_skin"));
- draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
- fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
- }
- if(fh < 0)
- {
- draw_currentSkin = "gfx/menu/default";
- fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
- }
-
- draw_currentSkin = strzone(draw_currentSkin);
+ LoadMenuSkinValues();
}
// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
float FONT_USER = 8;
+
+vector OFFSET_CURSOR = '0 0 0';
+vector SIZE_CURSOR = '32 32 0';
+void draw_cursor(vector pos, vector ofs, string img, vector col, float a);
+void draw_cursor_normal(vector pos, vector col, float a);
+void LoadMenuSkinValues();
+
// --------------------------------------------------------------------------
// Scoreboard stuff
MapVote_DrawAbstain(pos, dist.x, xmax - xmin, tmp, i);
}
- drawpic(mv_mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), '32 32 0', '1 1 1', 1 - autocvar__menu_alpha, DRAWFLAG_NORMAL);
+ draw_cursor_normal(mv_mousepos, '1 1 1', 1 - autocvar__menu_alpha);
}
void Cmd_MapVote_MapDownload(float argc)
}
}
- vector cursorsize = '32 32 0';
- drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', 0.8, DRAWFLAG_NORMAL);
+ draw_cursor_normal(mousepos, '1 1 1', 0.8);
prevMouseClicked = mouseClicked;
}