From cc22aeaeb409391dfa3b827c51174473660d42b8 Mon Sep 17 00:00:00 2001 From: fruitiex Date: Sun, 17 Jan 2010 09:49:58 +0000 Subject: [PATCH] fix small bug with badge, add support for a secondary mapshot dir into mapvotes git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8510 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/defaultNexuiz.cfg | 1 + data/qcsrc/client/mapvoting.qc | 4 ++-- data/qcsrc/client/sbar.qc | 20 +++++++++++++++----- data/qcsrc/server/g_world.qc | 19 +++++++++++++++++-- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index c73663931..46204e452 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -1128,6 +1128,7 @@ seta g_maplist_votable_suggestions_override_mostrecent 0 seta g_maplist_votable_nodetail 1 "nodetail only shows total count instead of all vote counts per map, so votes don't influence others that much" seta g_maplist_votable_abstain 0 "when 1, you can abstain from your vote" seta g_maplist_votable_screenshot_dir "maps" "where to look for map screenshots" +seta g_maplist_votable_screenshot_dir2 "levelshots" "fallback for map screenshots" alias suggestmap "cmd suggestmap $1" set g_chat_flood_spl 3 "normal chat: seconds between lines to not count as flooding" diff --git a/data/qcsrc/client/mapvoting.qc b/data/qcsrc/client/mapvoting.qc index 4cb824ad7..ef127c094 100644 --- a/data/qcsrc/client/mapvoting.qc +++ b/data/qcsrc/client/mapvoting.qc @@ -287,8 +287,6 @@ void MapVote_Init() mv_active = 1; - ssdir = ReadString(); - mv_num_maps = min(MAPVOTE_COUNT, ReadByte()); mv_abstain = ReadByte(); if(mv_abstain) @@ -313,7 +311,9 @@ void MapVote_Init() if(mv_maps_mask & power) { map = strzone(ReadString()); + ssdir = ReadString(); pk3 = strzone(ReadString()); + mv_maps[i] = map; mv_pk3[i] = pk3; map = strzone(strcat(ssdir, "/", map)); diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index becc9ae4c..4c207d42d 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -1577,33 +1577,43 @@ string MakeRaceString(float cp, float mytime, float histime, float lapdelta, str float race_status_time; float race_status_prev; +string race_status_name_prev; void Sbar_DrawRaceStatus(vector pos) { - if (race_status != race_status_prev) { + if (race_status != race_status_prev || race_status_name != race_status_name_prev) { race_status_time = time + 3; race_status_prev = race_status; + if (race_status_name_prev) + strunzone(race_status_name_prev); + race_status_name_prev = strzone(race_status_name); } float a; a = bound(0, race_status_time - time, 1); string s; - s = textShortenToWidth(race_status_name, 120/9, stringwidth_colors); + s = textShortenToWidth(race_status_name, 120/10, stringwidth_colors); if(race_status == 0) drawpic(pos, "gfx/hud/race/newtime", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL); else if(race_status == 1) { - drawpic(pos, "gfx/hud/race/newrank", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL); - drawcolorcodedstring(pos + '-20 80 0', s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/hud/race/newrank", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + '40 80 0' - '5 0 0' * stringwidth(s, TRUE), s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL); } else if(race_status == 2) { drawpic(pos, "gfx/hud/race/newrecord", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL); - drawcolorcodedstring(pos + '-20 80 0', s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + '40 80 0' - '5 0 0' * stringwidth(s, TRUE), s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL); } if (race_status_time - time <= 0) { race_status_prev = -1; race_status = -1; + if(race_status_name) + strunzone(race_status_name); + race_status_name = string_null; + if(race_status_name_prev) + strunzone(race_status_name_prev); + race_status_name_prev = string_null; } } diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index e05fb6cb7..c0f36ce48 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -2074,6 +2074,7 @@ float mapvote_keeptwotime; float mapvote_timeout; string mapvote_message; string mapvote_screenshot_dir; +string mapvote_screenshot_dir2; float mapvote_count; float mapvote_count_real; @@ -2201,6 +2202,11 @@ void MapVote_Init() mapvote_screenshot_dir = "maps"; mapvote_screenshot_dir = strzone(mapvote_screenshot_dir); + mapvote_screenshot_dir2 = cvar_string("g_maplist_votable_screenshot_dir2"); + if(mapvote_screenshot_dir2 == "") + mapvote_screenshot_dir2 = "levelshots"; + mapvote_screenshot_dir2 = strzone(mapvote_screenshot_dir2); + MapVote_Spawn(); } @@ -2240,7 +2246,7 @@ float MapVote_GetMapMask() entity mapvote_ent; float MapVote_SendEntity(entity to, float sf) { - string mapfile, pakfile; + string mapfile, mapfile2, pakfile; float i, o; if(sf & 1) @@ -2252,7 +2258,6 @@ float MapVote_SendEntity(entity to, float sf) if(sf & 1) { // flag 1 == initialization - WriteString(MSG_ENTITY, mapvote_screenshot_dir); WriteByte(MSG_ENTITY, mapvote_count); WriteByte(MSG_ENTITY, mapvote_abstain); WriteByte(MSG_ENTITY, mapvote_detail); @@ -2273,13 +2278,23 @@ float MapVote_SendEntity(entity to, float sf) { WriteString(MSG_ENTITY, mapvote_maps[i]); mapfile = strcat(mapvote_screenshot_dir, "/", mapvote_maps[i]); + mapfile2 = strcat(mapvote_screenshot_dir2, "/", mapvote_maps[i]); pakfile = whichpack(strcat(mapfile, ".tga")); if(pakfile == "") pakfile = whichpack(strcat(mapfile, ".jpg")); if(pakfile == "") pakfile = whichpack(strcat(mapfile, ".png")); + if(pakfile == "") { + mapvote_screenshot_dir = mapvote_screenshot_dir2; + pakfile = whichpack(strcat(mapfile2, ".tga")); + } + if(pakfile == "") + pakfile = whichpack(strcat(mapfile2, ".jpg")); + if(pakfile == "") + pakfile = whichpack(strcat(mapfile2, ".png")); for(o = strstr(pakfile, "/", 0)+1; o > 0; o = strstr(pakfile, "/", 0)+1) pakfile = substring(pakfile, o, 999); + WriteString(MSG_ENTITY, mapvote_screenshot_dir); WriteString(MSG_ENTITY, pakfile); } } -- 2.39.2