X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmain.qc;h=aa490aa505c21e8c38fc46c52f0813da9b266ed8;hb=a685802e37c3d93737d62224bc84f950cc086b4c;hp=7682198338308463520b72a815e03e4b8cd91b0d;hpb=692cb758fe8f25fa078bfd5885333ee031885600;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 768219833..aa490aa50 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -28,6 +28,58 @@ #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 @@ -125,7 +177,7 @@ void CSQC_Init() } hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin)); - draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin"))); + LoadMenuSkinValues(); } // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)