]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/combined_updates
authorSamual Lenks <samual@xonotic.org>
Sun, 9 Mar 2014 01:12:14 +0000 (20:12 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 9 Mar 2014 01:12:14 +0000 (20:12 -0500)
1  2 
qcsrc/common/util.qc
qcsrc/common/util.qh

diff --combined qcsrc/common/util.qc
index d668a384c30984c3c2038579e8944428778e8a31,c50a3ba5350d3b1fd1bdb394bc0b3ca5852026dd..ae903d5ff745074851a11bcea520470124d9fb44
@@@ -408,22 -408,6 +408,22 @@@ void buf_save(float buf, string pFilena
        fclose(fh);
  }
  
 +string format_time(float seconds)
 +{
 +      float days, hours, minutes;
 +      seconds = floor(seconds + 0.5);
 +        days = floor(seconds / 864000);
 +        seconds -= days * 864000;
 +        hours = floor(seconds / 36000);
 +        seconds -= hours * 36000;
 +      minutes = floor(seconds / 600);
 +      seconds -= minutes * 600;
 +        if (days > 0)
 +                return sprintf(_("%d days, %02d:%02d:%02d"), days, hours, minutes, seconds);
 +        else
 +                return sprintf(_("%02d:%02d:%02d"), hours, minutes, seconds);
 +}
 +
  string mmsss(float tenths)
  {
        float minutes;
@@@ -2575,6 -2559,7 +2575,6 @@@ void FindConnectedComponent(entity e, .
  }
  
  // todo: this sucks, lets find a better way to do backtraces?
 -#ifndef MENUQC
  void backtrace(string msg)
  {
        float dev, war;
        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)
@@@ -2803,3 -2789,18 +2803,18 @@@ float Mod_Q1BSP_NativeContentsFromSuper
        return CONTENT_EMPTY;
  }
  #endif
+ vector bezier_quadratic_getpoint(vector a, vector b, vector c, float t)
+ {
+       return
+               (c - 2 * b + a) * (t * t) +
+               (b - a) * (2 * t) +
+               a;
+ }
+ vector bezier_quadratic_getderivative(vector a, vector b, vector c, float t)
+ {
+       return
+               (c - 2 * b + a) * (2 * t) +
+               (b - a) * 2;
+ }
diff --combined qcsrc/common/util.qh
index bb65e312d90bbe596917f26df24c9887ca82b151,503aa2d2a0f9452fa81232493caa94e95383477b..b65f87b5b4ca8c8b1948dea912cc92f4a7512d4b
@@@ -105,7 -105,6 +105,7 @@@ float mod(float a, float b) { return a 
  #endif
  
  #define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
 +string format_time(float seconds);
  string mmsss(float t);
  string mmssss(float t);
  
@@@ -374,9 -373,9 +374,9 @@@ void FindConnectedComponent(entity e, .
  #define fprintf(file, ...) fputs(file, sprintf(__VA_ARGS__))
  #define bprintf(...) bprint(sprintf(__VA_ARGS__))
  
 -#ifndef MENUQC
 +//#ifndef MENUQC
  void backtrace(string msg);
 -#endif
 +//#endif
  
  // color code replace, place inside of sprintf and parse the string... defaults described as constants
  // foreground/normal colors
@@@ -442,3 -441,7 +442,7 @@@ float Announcer_PickNumber(float type, 
  float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents);
  float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents);
  #endif
+ // Quadratic splines (bezier)
+ vector bezier_quadratic_getpoint(vector a, vector p, vector b, float t);
+ vector bezier_quadratic_getderivative(vector a, vector p, vector b, float t);