diff --git a/code/__DEFINES/__513_compatibility.dm b/code/__DEFINES/__513_compatibility.dm new file mode 100644 index 0000000000..12577fb68b --- /dev/null +++ b/code/__DEFINES/__513_compatibility.dm @@ -0,0 +1,32 @@ + +#if DM_VERSION < 513 + +#define ismovableatom(A) (istype(A, /atom/movable)) + +#define islist(L) (istype(L, /list)) + +#define CLAMP01(x) (CLAMP(x, 0, 1)) + +#define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) ) + +#define ATAN2(x, y) ( !(x) && !(y) ? 0 : (y) >= 0 ? arccos((x) / sqrt((x)*(x) + (y)*(y))) : -arccos((x) / sqrt((x)*(x) + (y)*(y))) ) + +#define TAN(x) (sin(x) / cos(x)) + +#define arctan(x) (arcsin(x/sqrt(1+x*x))) + +////////////////////////////////////////////////// + +#else + +#define ismovableatom(A) ismovable(A) + +#define CLAMP01(x) clamp(x, 0, 1) + +#define CLAMP(CLVALUE, CLMIN, CLMAX) clamp(CLVALUE, CLMIN, CLMAX) + +#define TAN(x) tan(x) + +#define ATAN2(x, y) arctan(x, y) + +#endif diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 9f69da0154..0dee8bd1e8 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -1,11 +1,7 @@ // simple is_type and similar inline helpers -#define islist(L) (istype(L, /list)) - #define in_range(source, user) (get_dist(source, user) <= 1 && (get_step(source, 0)?:z) == (get_step(user, 0)?:z)) -#define ismovableatom(A) (istype(A, /atom/movable)) - #define isatom(A) (isloc(A)) #define isweakref(D) (istype(D, /datum/weakref)) @@ -246,4 +242,4 @@ GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list( #define isblobmonster(O) (istype(O, /mob/living/simple_animal/hostile/blob)) -#define isshuttleturf(T) (length(T.baseturfs) && (/turf/baseturf_skipover/shuttle in T.baseturfs)) +#define isshuttleturf(T) (length(T.baseturfs) && (/turf/baseturf_skipover/shuttle in T.baseturfs)) \ No newline at end of file diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index 5bce51293f..ad93dd2d54 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -16,7 +16,6 @@ #define TICK_USAGE_TO_MS(starting_tickusage) (TICK_DELTA_TO_MS(TICK_USAGE_REAL - starting_tickusage)) #define PERCENT(val) (round((val)*100, 0.1)) -#define CLAMP01(x) (CLAMP(x, 0, 1)) //time of day but automatically adjusts to the server going into the next day within the same round. //for when you need a reliable time number that doesn't depend on byond time. @@ -30,17 +29,12 @@ // round() acts like floor(x, 1) by default but can't handle other values #define FLOOR(x, y) ( round((x) / (y)) * (y) ) -#define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) ) - // Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive #define WRAP(val, min, max) ( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ) // Real modulus that handles decimals #define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) ) -// Tangent -#define TAN(x) (sin(x) / cos(x)) - // Cotangent #define COT(x) (1 / TAN(x)) @@ -50,8 +44,6 @@ // Cosecant #define CSC(x) (1 / sin(x)) -#define ATAN2(x, y) ( !(x) && !(y) ? 0 : (y) >= 0 ? arccos((x) / sqrt((x)*(x) + (y)*(y))) : -arccos((x) / sqrt((x)*(x) + (y)*(y))) ) - // Greatest Common Divisor - Euclid's algorithm /proc/Gcd(a, b) return b ? Gcd(b, (a) % (b)) : a @@ -207,4 +199,4 @@ #define LORENTZ_CUMULATIVE_DISTRIBUTION(x, y, s) ( (1/PI)*TORADIANS(arctan((x-y)/s)) + 1/2 ) #define RULE_OF_THREE(a, b, x) ((a*x)/b) -// ) +// ) \ No newline at end of file diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index fed283adcd..38b779427c 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -514,7 +514,7 @@ used_key_list[input_key] = 1 return input_key -#if DM_VERSION > 512 +#if DM_VERSION > 513 #error Remie said that lummox was adding a way to get a lists #error contents via list.values, if that is true remove this #error otherwise, update the version and bug lummox @@ -564,4 +564,4 @@ if(key in L1) L1[key] += other_value else - L1[key] = other_value + L1[key] = other_value \ No newline at end of file diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index ce294f3749..27b70d28c5 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -451,10 +451,6 @@ Turf and target are separate in case you want to teleport some distance from a t var/y = min(world.maxy, max(1, A.y + dy)) return locate(x,y,A.z) -/proc/arctan(x) - var/y=arcsin(x/sqrt(1+x*x)) - return y - /* Gets all contents of contents and returns them all in a list. */ diff --git a/tgstation.dme b/tgstation.dme index 31db79ce1f..a18113d9c9 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -16,6 +16,7 @@ #include "_maps\_basemap.dm" #include "code\_compile_options.dm" #include "code\world.dm" +#include "code\__DEFINES\__513_compatibility.dm" #include "code\__DEFINES\_globals.dm" #include "code\__DEFINES\_protect.dm" #include "code\__DEFINES\_tick.dm"