diff --git a/src/Entity.h b/src/Entity.h index f0bae6273..f14fb3612 100644 --- a/src/Entity.h +++ b/src/Entity.h @@ -97,7 +97,7 @@ Vector3 Entity_GetEyePosition(struct Entity* e); /* (i.e. distance to eye from feet/base of the model) */ float Entity_GetEyeHeight(struct Entity* e); /* Calculates the transformation matrix applied when rendering the given entity. */ -void Entity_GetTransform(struct Entity* e, Vector3 pos, Vector3 scale, struct Matrix* m); +CC_API void Entity_GetTransform(struct Entity* e, Vector3 pos, Vector3 scale, struct Matrix* m); void Entity_GetPickingBounds(struct Entity* e, struct AABB* bb); /* Gets the current collision bounds of the given entity. */ void Entity_GetBounds(struct Entity* e, struct AABB* bb); diff --git a/src/ExtMath.h b/src/ExtMath.h index 0806aabed..f4b7a6d69 100644 --- a/src/ExtMath.h +++ b/src/ExtMath.h @@ -20,8 +20,8 @@ float Math_SqrtF(float x); float Math_Mod1(float x); int Math_AbsI(int x); -double Math_Sin(double x); -double Math_Cos(double x); +CC_API double Math_Sin(double x); +CC_API double Math_Cos(double x); float Math_SinF(float x); float Math_CosF(float x); diff --git a/src/HeldBlockRenderer.c b/src/HeldBlockRenderer.c index 4bd1676c8..981bf6b5c 100644 --- a/src/HeldBlockRenderer.c +++ b/src/HeldBlockRenderer.c @@ -109,21 +109,21 @@ static void HeldBlockRenderer_ProjectionChanged(void* obj) { https://github.com/UnknownShadow200/ClassicalSharp/wiki/Dig-animation-details */ static void HeldBlockRenderer_DigAnimation(void) { - float sinHalfCircle, sinHalfCircleWeird; + double sinHalfCircle, sinHalfCircleWeird; float t, sqrtLerpPI; t = held_time / held_period; - sinHalfCircle = Math_SinF(t * MATH_PI); + sinHalfCircle = Math_Sin(t * MATH_PI); sqrtLerpPI = Math_SqrtF(t) * MATH_PI; - 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.X -= (float)Math_Sin(sqrtLerpPI) * 0.4f; + held_entity.Position.Y += (float)Math_Sin(sqrtLerpPI * 2) * 0.2f; + held_entity.Position.Z -= (float)sinHalfCircle * 0.2f; - sinHalfCircleWeird = Math_SinF(t * t * MATH_PI); - held_entity.RotY -= Math_SinF(sqrtLerpPI) * 80.0f; - held_entity.HeadY -= Math_SinF(sqrtLerpPI) * 80.0f; - held_entity.RotX += sinHalfCircleWeird * 20.0f; + sinHalfCircleWeird = Math_Sin(t * t * MATH_PI); + held_entity.RotY -= (float)Math_Sin(sqrtLerpPI) * 80.0f; + held_entity.HeadY -= (float)Math_Sin(sqrtLerpPI) * 80.0f; + held_entity.RotX += (float)sinHalfCircleWeird * 20.0f; } static void HeldBlockRenderer_ResetAnim(bool setLastHeld, double period) { diff --git a/src/Model.c b/src/Model.c index c04dd320d..3736fa806 100644 --- a/src/Model.c +++ b/src/Model.c @@ -198,9 +198,9 @@ void Model_DrawRotate(float angleX, float angleY, float angleZ, struct ModelPart struct ModelVertex* src = &model->vertices[part->Offset]; VertexP3fT2fC4b* dst = &Models.Vertices[model->index]; - float cosX = Math_CosF(-angleX), sinX = Math_SinF(-angleX); - float cosY = Math_CosF(-angleY), sinY = Math_SinF(-angleY); - float cosZ = Math_CosF(-angleZ), sinZ = Math_SinF(-angleZ); + float cosX = (float)Math_Cos(-angleX), sinX = (float)Math_Sin(-angleX); + float cosY = (float)Math_Cos(-angleY), sinY = (float)Math_Sin(-angleY); + float cosZ = (float)Math_Cos(-angleZ), sinZ = (float)Math_Sin(-angleZ); float t, x = part->RotX, y = part->RotY, z = part->RotZ; struct ModelVertex v; @@ -1374,9 +1374,9 @@ static void SpiderModel_Draw(struct Entity* entity) { Model_DrawPart(&spider_link); Model_DrawPart(&spider_end); - rotX = Math_SinF(entity->Anim.WalkTime) * entity->Anim.Swing * MATH_PI; - rotZ = Math_CosF(entity->Anim.WalkTime * 2) * entity->Anim.Swing * MATH_PI / 16.0f; - rotY = Math_SinF(entity->Anim.WalkTime * 2) * entity->Anim.Swing * MATH_PI / 32.0f; + rotX = (float)Math_Sin(entity->Anim.WalkTime) * entity->Anim.Swing * MATH_PI; + rotZ = (float)Math_Cos(entity->Anim.WalkTime * 2) * entity->Anim.Swing * MATH_PI / 16.0f; + rotY = (float)Math_Sin(entity->Anim.WalkTime * 2) * entity->Anim.Swing * MATH_PI / 32.0f; Models.Rotation = ROTATE_ORDER_XZY; Model_DrawRotate(rotX, quarterPi + rotY, eighthPi + rotZ, &spider_leftLeg, false); diff --git a/src/String.h b/src/String.h index 0b65fe39c..e715918cd 100644 --- a/src/String.h +++ b/src/String.h @@ -30,7 +30,7 @@ static CC_INLINE String String_Init(STRING_REF char* buffer, int length, int cap } /* Counts number of characters until a '\0' is found. */ -int String_CalcLen(const char* raw, int capacity); +CC_API int String_CalcLen(const char* raw, int capacity); /* Constructs a string from the given arguments, then sets all characters to '\0'. */ String String_InitAndClear(STRING_REF char* buffer, int capacity); /* Constructs a string from a (maybe null terminated) buffer. */