X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Futil.qh;h=570a41e0107b3434a00949e568ea00ce47bc2d5b;hb=3adaa0873ad9eac20f32e6e3fc0455d4f9e044cd;hp=10920c3a891cae60320606beac394656ee702626;hpb=9a199db20227fab8dd8d446f2ef59f74b8178f06;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 10920c3a8..570a41e01 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -1,4 +1,3 @@ -#define WANT_CONST // commonly used, but better make them macros #define TRUE 1 #define FALSE 0 @@ -6,6 +5,12 @@ // a dummy macro that prevents the "hanging ;" warning #define ENDS_WITH_CURLY_BRACE +#ifdef GMQCC +# define ACCUMULATE_FUNCTION(func,otherfunc) \ + [[accumulate]] void func() { otherfunc(); } +# define CALL_ACCUMULATED_FUNCTION(func) \ + func() +#else #ifdef HAVE_YO_DAWG_CPP // TODO make ascii art pic of xzibit // YO DAWG! @@ -41,6 +46,7 @@ void ACCUMULATE_call(string func) # define CALL_ACCUMULATED_FUNCTION(func) \ ACCUMULATE_call(#func) #endif +#endif // used for simplifying ACCUMULATE_FUNCTIONs #define SET_FIRST_OR_LAST(input,first,count) if(!input) { input = (first + count); } @@ -94,7 +100,7 @@ void buf_save(float buf, string filename); // modulo function #ifndef MENUQC -float mod(float a, float b) { return a - (floor(a / b) * b); } +float mod(float a, float b) { return a - (floor(a / b) * b); } #endif #define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4) @@ -208,7 +214,7 @@ float compressShotOrigin(vector v); vector decompressShotOrigin(float f); #ifdef SVQC -string rankings_reply, ladder_reply, lsmaps_reply, maplist_reply; // cached replies +string rankings_reply, ladder_reply, lsmaps_reply, maplist_reply, monsterlist_reply; // cached replies string records_reply[10]; #endif @@ -357,9 +363,20 @@ typedef entity(entity cur, entity near, entity pass) findNextEntityNearFunction_ typedef float(entity a, entity b, entity pass) isConnectedFunction_t; void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass); +#ifdef SVQC +vector combine_to_vector(float x, float y, float z); +vector get_corner_position(entity box, float corner); +#endif + // expand multiple arguments into one argument by stripping parenthesis #define XPD(...) __VA_ARGS__ +// Some common varargs functions. Lowercase as they match C. +#define printf(...) print(sprintf(__VA_ARGS__)) +#define dprintf(...) dprint(sprintf(__VA_ARGS__)) +#define fprintf(file, ...) fputs(file, sprintf(__VA_ARGS__)) +#define bprintf(...) bprint(sprintf(__VA_ARGS__)) + #ifndef MENUQC void backtrace(string msg); #endif @@ -423,3 +440,14 @@ void dedicated_print(string input); #define CNT_ROUNDSTART 6 float Announcer_PickNumber(float type, float num); #endif + +#ifndef MENUQC +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); + +#define APPEND_TO_STRING(list,sep,add) ((list) = (((list) != "") ? strcat(list, sep, add) : (add)))