From: Samual Lenks Date: Sun, 10 Feb 2013 00:49:22 +0000 (-0500) Subject: Merge remote-tracking branch 'origin/master' into samual/notification_rewrite X-Git-Tag: xonotic-v0.7.0~62^2~23^2~237 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=8f0f47ad72cb8977d36e9690cd958f37825097d2;p=xonotic%2Fxonotic-data.pk3dir.git Merge remote-tracking branch 'origin/master' into samual/notification_rewrite Conflicts: qcsrc/common/util.qc qcsrc/common/util.qh --- 8f0f47ad72cb8977d36e9690cd958f37825097d2 diff --cc qcsrc/common/util.qc index dc882194e,404bd7e5a..e781a4dcb --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@@ -2480,75 -2480,31 +2480,104 @@@ void FindConnectedComponent(entity e, . queue_start.FindConnectedComponent_processing = 0; } +float Count_Proper_Strings(string improper, string...count) +{ + float i, total = 0; + string tmp; + + for(i = 0; i < count; ++i) + { + tmp = ...(i, string); + if((tmp) && (tmp != improper)) { ++total; } + } + + return total; +} + +float Count_Proper_Floats(float improper, float...count) +{ + float i, total = 0; + + for(i = 0; i < count; ++i) + { + if(...(i, float) != improper) { ++total; } + } + + return total; +} + +// todo: this sucks, lets find a better way to do backtraces? +#ifndef MENUQC +void backtrace(string msg) +{ + float dev, war; + #ifdef SVQC + dev = autocvar_developer; + war = autocvar_prvm_backtraceforwarnings; + #else + dev = cvar("developer"); + war = cvar("prvm_backtraceforwarnings"); + #endif + cvar_set("developer", "1"); + cvar_set("prvm_backtraceforwarnings", "1"); + print("\n"); + print("--- CUT HERE ---\nWARNING: "); + print(msg); + print("\n"); + remove(world); // isn't there any better way to cause a backtrace? + print("\n--- CUT UNTIL HERE ---\n"); + cvar_set("developer", ftos(dev)); + cvar_set("prvm_backtraceforwarnings", ftos(war)); +} +#endif + +// color code replace, place inside of sprintf and parse the string +string CCR(string input) +{ + // See the autocvar declarations in util.qh for default values + + // foreground/normal colors + input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input); + input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input); + input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input); + input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input); + + // "kill" colors + input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input); + input = strreplace("^K2", strcat("^", autocvar_hud_colorset_kill_2), input); + input = strreplace("^K3", strcat("^", autocvar_hud_colorset_kill_3), input); + + // background colors + input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input); + input = strreplace("^N", "^7", input); // "none"-- reset to white... + return input; +} ++ + vector vec3(float x, float y, float z) + { + vector v; + v_x = x; + v_y = y; + v_z = z; + return v; + } + + #ifndef MENUQC + vector animfixfps(entity e, vector a, vector b) + { + // multi-frame anim: keep as-is + if(a_y == 1) + { + float dur; + dur = frameduration(e.modelindex, a_x); + if(dur <= 0 && b_y) + { + a = b; + dur = frameduration(e.modelindex, a_x); + } + if(dur > 0) + a_z = 1.0 / dur; + } + return a; + } + #endif diff --cc qcsrc/common/util.qh index 2c9ed82b2,4e553e4ba..f5fa6eaab --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@@ -373,41 -365,8 +373,47 @@@ typedef entity(entity cur, entity near typedef float(entity a, entity b, entity pass) isConnectedFunction_t; void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass); +// expand multiple arguments into one argument by stripping parenthesis +#define XPD(...) __VA_ARGS__ + +float Count_Proper_Strings(string improper, string...count); +float Count_Proper_Floats(float improper, float...count); + +#ifndef MENUQC +void backtrace(string msg); +#endif + +// color code replace, place inside of sprintf and parse the string... defaults described as constants +// foreground/normal colors +var string autocvar_hud_colorset_foreground_1 = "2"; // F1 - Green // primary priority (important names, etc) +var string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc) +var string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue // tertiary priority or relatively inconsequential text +var string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red // notice/attention grabbing texting +// "kill" colors +var string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red // "bad" or "dangerous" text (death messages against you, kill notifications, etc) +var string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type +var string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue // "good" or "beneficial" text (you fragging someone, etc) +// background color +var string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text + +string CCR(string input); + +#ifndef MENUQC +#ifdef CSQC +#define GENTLE (autocvar_cl_gentle || autocvar_cl_gentle_messages) +#else +#define GENTLE autocvar_sv_gentle +#endif +#define normal_or_gentle(normal,gentle) (GENTLE ? ((gentle != "") ? gentle : normal) : normal) +#endif + +// allow writing to also pass through to spectators (like so spectators see the same centerprints as players for example) +#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname +#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement) +#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0 ++ + vector vec3(float x, float y, float z); + + #ifndef MENUQC + vector animfixfps(entity e, vector a, vector b); + #endif diff --cc qcsrc/server/cl_player.qc index 165783781,03347a9c8..10ca2ccab --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@@ -1256,10 -1167,10 +1168,10 @@@ void FakeGlobalSound(string sample, flo case VOICETYPE_TAUNT: if(self.classname == "player") if(self.deadflag == DEAD_NO) - setanim(self, self.anim_taunt, FALSE, TRUE, TRUE); + animdecide_setaction(self, ANIMACTION_TAUNT, TRUE); if(!sv_taunt) break; - if(sv_gentle) + if(autocvar_sv_gentle) break; msg_entity = self; if (msg_entity.cvar_cl_voice_directional >= 1) @@@ -1353,10 -1264,10 +1265,10 @@@ void GlobalSound(string sample, float c case VOICETYPE_TAUNT: if(self.classname == "player") if(self.deadflag == DEAD_NO) - setanim(self, self.anim_taunt, FALSE, TRUE, TRUE); + animdecide_setaction(self, ANIMACTION_TAUNT, TRUE); if(!sv_taunt) break; - if(sv_gentle) + if(autocvar_sv_gentle) break; FOR_EACH_REALCLIENT(msg_entity) { diff --cc qcsrc/server/progs.src index 71f088ba5,db9311610..dcd144d31 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@@ -235,7 -233,7 +236,8 @@@ mutators/mutator_superspec.q ../warpzonelib/util_server.qc ../warpzonelib/server.qc + ../common/animdecide.qc ../common/util.qc +../common/notifications.qc ../common/if-this-file-errors-scroll-up-and-fix-the-warnings.fteqccfail