mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Statically link to msvc CRT in release builds
This commit is contained in:
parent
e80d3075ec
commit
f2c6b4c45b
@ -148,7 +148,7 @@
|
||||
<MinimumRequiredVersion>5.02</MinimumRequiredVersion>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<AdditionalDependencies>d3d9.lib;opengl32.lib;ucrtd.lib;vcruntimed.lib;dbghelp.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d9.lib;opengl32.lib;libucrt.lib;libvcruntime.lib;dbghelp.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
@ -175,7 +175,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<AdditionalDependencies>d3d9.lib;opengl32.lib;ucrtd.lib;vcruntimed.lib;dbghelp.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d9.lib;opengl32.lib;libucrt.lib;libvcruntime.lib;dbghelp.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -205,15 +205,15 @@ static void Huffman_Build(HuffmanTable* table, UInt8* bitLens, Int32 count) {
|
||||
UInt16 bl_offsets[INFLATE_MAX_BITS];
|
||||
for (i = 1; i < INFLATE_MAX_BITS; i++) {
|
||||
code = (code + bl_count[i - 1]) << 1;
|
||||
bl_offsets[i] = (UInt16)offset;
|
||||
table->FirstCodewords[i] = (UInt16)code;
|
||||
table->FirstOffsets[i] = (UInt16)offset;
|
||||
|
||||
bl_offsets[i] = offset;
|
||||
table->FirstCodewords[i] = code;
|
||||
table->FirstOffsets[i] = offset;
|
||||
offset += bl_count[i];
|
||||
|
||||
/* Last codeword is actually: code + (bl_count[i] - 1) */
|
||||
/* When decoding we peform < against this value though, so we need to add 1 here */
|
||||
if (bl_count[i]) {
|
||||
table->EndCodewords[i] = (UInt16)(code + bl_count[i]);
|
||||
table->EndCodewords[i] = code + bl_count[i];
|
||||
} else {
|
||||
table->EndCodewords[i] = 0;
|
||||
}
|
||||
@ -224,7 +224,7 @@ static void Huffman_Build(HuffmanTable* table, UInt8* bitLens, Int32 count) {
|
||||
for (i = 0; i < count; i++, value++) {
|
||||
Int32 len = bitLens[i];
|
||||
if (len == 0) continue;
|
||||
table->Values[bl_offsets[len]] = (UInt16)value;
|
||||
table->Values[bl_offsets[len]] = value;
|
||||
|
||||
/* Computes the accelerated lookup table values for this codeword
|
||||
* For example, assume len = 4 and codeword = 0100
|
||||
|
@ -3,19 +3,20 @@
|
||||
|
||||
/* TODO: Replace with own functions that don't rely on stdlib */
|
||||
|
||||
Real32 Math_AbsF(Real32 x) { return fabsf(x); }
|
||||
Real32 Math_SinF(Real32 x) { return sinf(x); }
|
||||
Real32 Math_CosF(Real32 x) { return cosf(x); }
|
||||
Real32 Math_TanF(Real32 x) { return tanf(x); }
|
||||
Real32 Math_SqrtF(Real32 x) { return sqrtf(x); }
|
||||
Real32 Math_Mod1(Real32 x) { return x - (Int32)x; /* fmodf(x, 1); */ }
|
||||
Real32 Math_AbsF(Real32 x) { return fabsf(x); /* MSVC intrinsic */ }
|
||||
Real32 Math_SqrtF(Real32 x) { return sqrtf(x); /* MSVC intrinsic */ }
|
||||
Real32 Math_Mod1(Real32 x) { return x - (Int32)x; /* fmodf(x, 1); */ }
|
||||
Int32 Math_AbsI(Int32 x) { return abs(x); /* MSVC intrinsic */ }
|
||||
|
||||
Real64 Math_Sin(Real64 x) { return sin(x); }
|
||||
Real64 Math_Cos(Real64 x) { return cos(x); }
|
||||
Real64 Math_Log(Real64 x) { return log(x); }
|
||||
Real64 Math_Exp(Real64 x) { return exp(x); }
|
||||
Real64 Math_Asin(Real64 x) { return asin(x); }
|
||||
Real64 Math_Atan2(Real64 y, Real64 x) { return atan2(y, x); }
|
||||
|
||||
Int32 Math_AbsI(Int32 x) { return abs(x); }
|
||||
Real32 Math_SinF(Real32 x) { return (Real32)Math_Sin(x); }
|
||||
Real32 Math_CosF(Real32 x) { return (Real32)Math_Cos(x); }
|
||||
Real32 Math_TanF(Real32 x) { return tanf(x); }
|
||||
|
||||
Int32 Math_Floor(Real32 value) {
|
||||
Int32 valueI = (Int32)value;
|
||||
return valueI > value ? valueI - 1 : valueI;
|
||||
@ -76,4 +77,32 @@ Int32 Math_AccumulateWheelDelta(Real32* accmulator, Real32 delta) {
|
||||
Int32 steps = (Int32)*accmulator;
|
||||
*accmulator -= steps;
|
||||
return steps;
|
||||
}
|
||||
|
||||
/* Not the most precise Tan(x), but within 10^-15 of answer, so good enough for here */
|
||||
Real64 Math_FastTan(Real64 angle) {
|
||||
Real64 cosA = Math_Cos(angle), sinA = Math_Sin(angle);
|
||||
if (cosA < -0.00000001 || cosA > 0.00000001) return sinA / cosA;
|
||||
|
||||
/* tan line is parallel to y axis, infinite gradient */
|
||||
Int32 sign = Math_Sign(sinA);
|
||||
if (cosA != 0.0) sign *= Math_Sign(cosA);
|
||||
return sign * MATH_POS_INF;
|
||||
}
|
||||
|
||||
Real64 Math_FastLog(Real64 x) {
|
||||
/* x = 2^exp * mantissa */
|
||||
/* so log(x) = log(2^exp) + log(mantissa) */
|
||||
/* so log(x) = exp*log(2) + log(mantissa) */
|
||||
|
||||
/* now need to work out log(mantissa) */
|
||||
}
|
||||
|
||||
Real64 Math_FastExp(Real64 x) {
|
||||
/* let x = k*log(2) + f, where k is integer */
|
||||
/* so exp(x) = exp(k*log(2)) * exp(f) */
|
||||
/* so exp(x) = exp(log(2^k)) * exp(f) */
|
||||
/* so exp(x) = 2^k * exp(f) */
|
||||
|
||||
/* now need to work out exp(f) */
|
||||
}
|
@ -15,18 +15,19 @@
|
||||
#define Math_Packed2Deg(x) ((x) * 360.0f / 256.0f)
|
||||
|
||||
Real32 Math_AbsF(Real32 x);
|
||||
Real32 Math_SinF(Real32 x);
|
||||
Real32 Math_CosF(Real32 x);
|
||||
Real32 Math_TanF(Real32 x);
|
||||
Real32 Math_SqrtF(Real32 x);
|
||||
Real32 Math_Mod1(Real32 x);
|
||||
Int32 Math_AbsI(Int32 x);
|
||||
|
||||
Real64 Math_Sin(Real64 x);
|
||||
Real64 Math_Cos(Real64 x);
|
||||
Real32 Math_SinF(Real32 x);
|
||||
Real32 Math_CosF(Real32 x);
|
||||
|
||||
Real64 Math_Log(Real64 x);
|
||||
Real64 Math_Exp(Real64 x);
|
||||
Real64 Math_Asin(Real64 x);
|
||||
Real64 Math_Atan2(Real64 y, Real64 x);
|
||||
Real64 Math_FastTan(Real64 x);
|
||||
|
||||
Int32 Math_AbsI(Int32 x);
|
||||
Int32 Math_Floor(Real32 value);
|
||||
Int32 Math_Ceil(Real32 value);
|
||||
Int32 Math_Log2(Int32 value);
|
||||
|
@ -108,12 +108,12 @@ static void HeldBlockRenderer_DigAnimation(void) {
|
||||
|
||||
held_entity.Position.X -= Math_SinF(sqrtLerpPI) * 0.4f;
|
||||
held_entity.Position.Y += Math_SinF((sqrtLerpPI * 2)) * 0.2f;
|
||||
held_entity.Position.Z -= sinHalfCircle * 0.2f;
|
||||
held_entity.Position.Z -= sinHalfCircle * 0.2f;
|
||||
|
||||
Real32 sinHalfCircleWeird = Math_SinF(t * t * MATH_PI);
|
||||
held_entity.RotY -= Math_SinF(sqrtLerpPI) * 80.0f;
|
||||
held_entity.RotY -= Math_SinF(sqrtLerpPI) * 80.0f;
|
||||
held_entity.HeadY -= Math_SinF(sqrtLerpPI) * 80.0f;
|
||||
held_entity.RotX += sinHalfCircleWeird * 20.0f;
|
||||
held_entity.RotX += sinHalfCircleWeird * 20.0f;
|
||||
}
|
||||
|
||||
static void HeldBlockRenderer_ResetAnim(bool setLastHeld, Real64 period) {
|
||||
|
@ -152,10 +152,10 @@ Vector3 Vector3_GetDirVector(Real32 yawRad, Real32 pitchRad) {
|
||||
return Vector3_Create3(x, y, z);
|
||||
}
|
||||
|
||||
void Vector3_GetHeading(Vector3 dir, Real32* yaw, Real32* pitch) {
|
||||
/*void Vector3_GetHeading(Vector3 dir, Real32* yaw, Real32* pitch) {
|
||||
*pitch = (Real32)Math_Asin(-dir.Y);
|
||||
*yaw = (Real32)Math_Atan2(dir.X, -dir.Z);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
Matrix Matrix_Identity = {
|
||||
@ -250,7 +250,7 @@ void Matrix_OrthographicOffCenter(Matrix* result, Real32 left, Real32 right, Rea
|
||||
}
|
||||
|
||||
void Matrix_PerspectiveFieldOfView(Matrix* result, Real32 fovy, Real32 aspect, Real32 zNear, Real32 zFar) {
|
||||
Real32 c = zNear * Math_TanF(0.5f * fovy);
|
||||
Real32 c = zNear * (Real32)Math_FastTan(0.5f * fovy);
|
||||
Matrix_PerspectiveOffCenter(result, -c * aspect, c * aspect, -c, c, zNear, zFar);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void Vector3I_Max(Vector3I* result, Vector3I* a, Vector3I* b);
|
||||
Vector3 Vector3_GetDirVector(Real32 yawRad, Real32 pitchRad);
|
||||
/* Returns the yaw and pitch of the given direction vector.
|
||||
NOTE: This is not an identity function. Returned pitch is always within [-90, 90] degrees.*/
|
||||
void Vector3_GetHeading(Vector3 dir, Real32* yawRad, Real32* pitchRad);
|
||||
/*void Vector3_GetHeading(Vector3 dir, Real32* yawRad, Real32* pitchRad);*/
|
||||
|
||||
void Matrix_RotateX(Matrix* result, Real32 angle);
|
||||
void Matrix_RotateY(Matrix* result, Real32 angle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user