mahlendur/_work/Data/Scripts/Content/Spine/Spine_Utils.d
Daniel Heße 892a40ff0f Initial commit with Subversion-codebase from 13/05/2022.
Cleaned up the mess, at this time, only viable data get synced (_work directory for Gothic-data, miranda for mdc-scripts.
Need to symlink files to a working directory.
2022-05-13 17:38:52 +02:00

39 lines
721 B
D

// returns the minimum of the two values a and b
func int min(var int a, var int b) {
if (a < b) {
return a;
} else {
return b;
};
};
// returns the maximum of the two values a and b
func int max(var int a, var int b) {
if (a > b) {
return a;
} else {
return b;
};
};
// sets value within the range of lo and hi
// if value < lo => value = lo
// if value > hi => value = hi
func int clamp(var int value, var int lo, var int hi) {
value = max(value, lo);
value = min(value, hi);
return value;
};
// frees a library
func void FreeLibrary (var int ptr) {
var int freelib;
freelib = FindKernelDllFunction("FreeLibrary");
if (!freelib) {
return;
};
CALL_PtrParam(ptr);
CALL__stdcall(freelib);
};