C++ compile fixes
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 23 Feb 2009 07:20:38 +0000 (07:20 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 23 Feb 2009 07:20:38 +0000 (07:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8756 d7cf8633-e32d-0410-b094-e92efae38249

cap_ogg.c
mathlib.h
model_alias.c

index adbe1bd..159457d 100644 (file)
--- a/cap_ogg.c
+++ b/cap_ogg.c
@@ -1024,13 +1024,13 @@ void SCR_CaptureVideo_Ogg_BeginVideo()
                        if(ti.quality < 0)
                        {
                                ti.target_bitrate = bound(45000, ti.target_bitrate, 2000000);
-                               ti.keyframe_data_target_bitrate = ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value);
+                               ti.keyframe_data_target_bitrate = (int) (ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value));
                                ti.quality = -1;
                        }
                        else
                        {
                                ti.target_bitrate = bound(45000, ti.target_bitrate, 2000000);
-                               ti.keyframe_data_target_bitrate = ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value);
+                               ti.keyframe_data_target_bitrate = (int) (ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value));
                                ti.quality = -1;
                        }
                }
index 44114ae..70f7198 100644 (file)
--- a/mathlib.h
+++ b/mathlib.h
@@ -94,6 +94,7 @@ unsigned int CeilPowerOf2(unsigned int value);
 #define VectorLength(a) (sqrt(DotProduct(a, a)))
 #define VectorLength2(a) (DotProduct(a, a))
 #define VectorScale(in, scale, out) ((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale))
+#define VectorScaleCast(in, scale, outtype, out) ((out)[0] = (outtype) ((in)[0] * (scale)),(out)[1] = (outtype) ((in)[1] * (scale)),(out)[2] = (outtype) ((in)[2] * (scale)))
 #define VectorCompare(a,b) (((a)[0]==(b)[0])&&((a)[1]==(b)[1])&&((a)[2]==(b)[2]))
 #define VectorMA(a, scale, b, c) ((c)[0] = (a)[0] + (scale) * (b)[0],(c)[1] = (a)[1] + (scale) * (b)[1],(c)[2] = (a)[2] + (scale) * (b)[2])
 #define VectorM(scale1, b1, c) ((c)[0] = (scale1) * (b1)[0],(c)[1] = (scale1) * (b1)[1],(c)[2] = (scale1) * (b1)[2])
index 6feaa12..0ae37d5 100644 (file)
@@ -614,8 +614,8 @@ static void Mod_Alias_MorphMesh_CompileFrames(void)
                // encode the svector and tvector in 3 byte format for permanent storage
                for (j = 0;j < loadmodel->surfmesh.num_vertices;j++)
                {
-                       VectorScale(loadmodel->surfmesh.data_svector3f + j * 3, 127.0f, loadmodel->surfmesh.data_morphtexvecvertex[i*loadmodel->surfmesh.num_vertices+j].svec);
-                       VectorScale(loadmodel->surfmesh.data_tvector3f + j * 3, 127.0f, loadmodel->surfmesh.data_morphtexvecvertex[i*loadmodel->surfmesh.num_vertices+j].tvec);
+                       VectorScaleCast(loadmodel->surfmesh.data_svector3f + j * 3, 127.0f, signed char, loadmodel->surfmesh.data_morphtexvecvertex[i*loadmodel->surfmesh.num_vertices+j].svec);
+                       VectorScaleCast(loadmodel->surfmesh.data_tvector3f + j * 3, 127.0f, signed char, loadmodel->surfmesh.data_morphtexvecvertex[i*loadmodel->surfmesh.num_vertices+j].tvec);
                }
        }
 }