summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorleo2000-11-15 01:52:44 +0000
committerleo2000-11-15 01:52:44 +0000
commit09746a951bb47ab3813f2fda9cf48444aca372b9 (patch)
treee4b94ea4858559d07efc0fdf8bc45018f995d52a /common
parentec77f06c40c9e0986e82096105bd9f90d0c4a46b (diff)
fix VC++ warnings/errors
git-svn-id: http://svn.leocad.org/trunk@163 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common')
-rw-r--r--common/camera.cpp2
-rw-r--r--common/defines.h5
-rwxr-xr-xcommon/library.cpp10
-rw-r--r--common/light.cpp23
-rw-r--r--common/matrix.cpp14
-rwxr-xr-xcommon/object.cpp3
6 files changed, 33 insertions, 24 deletions
diff --git a/common/camera.cpp b/common/camera.cpp
index 28ef716..64c0b98 100644
--- a/common/camera.cpp
+++ b/common/camera.cpp
@@ -592,7 +592,7 @@ void Camera::Render(float fLineWidth)
modelview.Invert ();
glMultMatrixf (modelview.m);
- projection.CreatePerspective (m_fovy, 1.33f, 0.01, len);
+ projection.CreatePerspective (m_fovy, 1.33f, 0.01f, len);
projection.Invert ();
glMultMatrixf (projection.m);
diff --git a/common/defines.h b/common/defines.h
index 9cb8391..d9c818f 100644
--- a/common/defines.h
+++ b/common/defines.h
@@ -91,8 +91,11 @@ unsigned long SwapLONG(unsigned long x)
#define FLOATRGB(f) RGB(f[0]*255, f[1]*255, f[2]*255)
+#ifndef M_PI
+#define M_PI 3.14159265
+#endif
+
#define LC_CONNECTIONS 2 // Different piece connections
-#define LC_APP_VERSION 0.72f // Current version
#define LC_STR_VERSION "LeoCAD 0.7 Project\0\0" // char[20]
#define LC_MAXCOLORS 28 // Number of colors supported
diff --git a/common/library.cpp b/common/library.cpp
index b360461..c3bc10f 100755
--- a/common/library.cpp
+++ b/common/library.cpp
@@ -276,7 +276,8 @@ static unsigned long GetDefaultPieceGroup(char* name)
strstr(tmp,"Windscr") || strstr(tmp,"~2421") ||
strstr(tmp,"Wing") || strstr(tmp,"Wedge") ||
strstr(tmp,"Propellor") || strstr(tmp,"Rotor") ||
- strstr(tmp,"Rack") || strstr(tmp,"Tail"))
+ strstr(tmp,"Rack") || strstr(tmp,"Tail") ||
+ strstr(tmp,"Cockpit"))
return 0x020;
if (strstr(tmp,"Train"))
@@ -294,7 +295,9 @@ static unsigned long GetDefaultPieceGroup(char* name)
strstr(tmp,"Scala") || strstr(tmp,"Boat") ||
strstr(tmp,"Trailer") || strstr(tmp,"Box") ||
strstr(tmp,"Turntab") || strstr(tmp,"Winch") ||
- strstr(tmp,"Door") || strstr(tmp,"Magnet"))
+ strstr(tmp,"Door") || strstr(tmp,"Magnet") ||
+ strstr(tmp,"Staircase") || strstr(tmp,"Glass") ||
+ strstr(tmp,"Container"))
return 0x080;
// accessories
@@ -312,7 +315,8 @@ static unsigned long GetDefaultPieceGroup(char* name)
strstr(tmp,"Belville") || strstr(tmp,"Light &")||
strstr(tmp,"Hose") || strstr(tmp,"Arm P") ||
strstr(tmp,"Brush") || strstr(tmp,"Castle") ||
- strstr(tmp,"Tipper") || strstr(tmp,"Bar"))
+ strstr(tmp,"Tipper") || strstr(tmp,"Bar") ||
+ strstr(tmp,"Animal"))
return 0x100;
return 1;
diff --git a/common/light.cpp b/common/light.cpp
index 12d5cc6..c0ea064 100644
--- a/common/light.cpp
+++ b/common/light.cpp
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
+#include <math.h>
#include "light.h"
#include "defines.h"
#include "globals.h"
@@ -226,8 +227,8 @@ void Light::UpdatePosition (unsigned short nTime, bool bAnimation)
float verts[16*3];
for (int i = 0; i < 8; i++)
{
- verts[i*6] = verts[i*6+3] = cos ((float)i/4 * PI) * 0.3f;
- verts[i*6+1] = verts[i*6+4] = sin ((float)i/4 * PI) * 0.3f;
+ verts[i*6] = verts[i*6+3] = (float)cos ((float)i/4 * PI) * 0.3f;
+ verts[i*6+1] = verts[i*6+4] = (float)sin ((float)i/4 * PI) * 0.3f;
verts[i*6+2] = 0.3f;
verts[i*6+5] = -0.3f;
}
@@ -384,17 +385,17 @@ void Light::Render (float fLineWidth)
if (fabs (frontvec.X ()) < fabs (frontvec.Y ()))
{
- if (fabs (frontvec.X ()) < fabs (frontvec.Z ()))
- up[0] = -(up[1]*frontvec.Y () + up[2]*frontvec.Z ());
- else
- up[2] = -(up[0]*frontvec.X () + up[1]*frontvec.Y ());
+ if (fabs (frontvec.X ()) < fabs (frontvec.Z ()))
+ up[0] = -(up[1]*frontvec.Y () + up[2]*frontvec.Z ());
+ else
+ up[2] = -(up[0]*frontvec.X () + up[1]*frontvec.Y ());
}
else
{
- if (fabs (frontvec.Y ()) < fabs (frontvec.Z ()))
- up[1] = -(up[0]*frontvec.X () + up[2]*frontvec.Z ());
- else
- up[2] = -(up[0]*frontvec.X () + up[1]*frontvec.Y ());
+ if (fabs (frontvec.Y ()) < fabs (frontvec.Z ()))
+ up[1] = -(up[0]*frontvec.X () + up[2]*frontvec.Z ());
+ else
+ up[2] = -(up[0]*frontvec.X () + up[1]*frontvec.Y ());
}
glPushMatrix ();
@@ -403,7 +404,7 @@ void Light::Render (float fLineWidth)
modelview.Invert ();
glMultMatrixf (modelview.m);
- projection.CreatePerspective (2*m_fCutoff, 1.0f, 0.01, len);
+ projection.CreatePerspective (2*m_fCutoff, 1.0f, 0.01f, len);
projection.Invert ();
glMultMatrixf (projection.m);
diff --git a/common/matrix.cpp b/common/matrix.cpp
index 962f9b1..a535cde 100644
--- a/common/matrix.cpp
+++ b/common/matrix.cpp
@@ -720,7 +720,7 @@ void Matrix::CreatePerspective (float fovy, float aspect, float nearval, float f
LoadIdentity ();
- top = nearval * tan (fovy * M_PI / 360.0);
+ top = nearval * (float)tan (fovy * M_PI / 360.0);
bottom = -top;
left = bottom * aspect;
@@ -729,12 +729,12 @@ void Matrix::CreatePerspective (float fovy, float aspect, float nearval, float f
if ((nearval<=0.0 || farval<=0.0) || (nearval == farval) || (left == right) || (top == bottom))
return;
- x = (2.0*nearval) / (right-left);
- y = (2.0*nearval) / (top-bottom);
+ x = (2.0f*nearval) / (right-left);
+ y = (2.0f*nearval) / (top-bottom);
a = (right+left) / (right-left);
b = (top+bottom) / (top-bottom);
c = -(farval+nearval) / ( farval-nearval);
- d = -(2.0*farval*nearval) / (farval-nearval);
+ d = -(2.0f*farval*nearval) / (farval-nearval);
#define M(row,col) m[col*4+row]
M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F;
@@ -752,7 +752,7 @@ void Matrix::CreateLookat (float eye[3], float target[3], float up[3])
z[0] = eye[0] - target[0];
z[1] = eye[1] - target[1];
z[2] = eye[2] - target[2];
- mag = sqrt (z[0]*z[0] + z[1]*z[1] + z[2]*z[2]);
+ mag = (float)sqrt (z[0]*z[0] + z[1]*z[1] + z[2]*z[2]);
if (mag)
{
z[0] /= mag;
@@ -774,7 +774,7 @@ void Matrix::CreateLookat (float eye[3], float target[3], float up[3])
y[1] = -z[0]*x[2] + z[2]*x[0];
y[2] = z[0]*x[1] - z[1]*x[0];
- mag = sqrt (x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
+ mag = (float)sqrt (x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
if (mag)
{
x[0] /= mag;
@@ -782,7 +782,7 @@ void Matrix::CreateLookat (float eye[3], float target[3], float up[3])
x[2] /= mag;
}
- mag = sqrt (y[0]*y[0] + y[1]*y[1] + y[2]*y[2]);
+ mag = (float)sqrt (y[0]*y[0] + y[1]*y[1] + y[2]*y[2]);
if (mag)
{
y[0] /= mag;
diff --git a/common/object.cpp b/common/object.cpp
index 1dd8d44..f62239b 100755
--- a/common/object.cpp
+++ b/common/object.cpp
@@ -242,7 +242,8 @@ void Object::ChangeKey (unsigned short nTime, bool bAnimation, bool bAddKey, con
void Object::CalculateKeys (unsigned short nTime, bool bAnimation)
{
- LC_OBJECT_KEY *next[m_nKeyInfoCount], *prev[m_nKeyInfoCount], *node;
+// LC_OBJECT_KEY *next[m_nKeyInfoCount], *prev[m_nKeyInfoCount], *node;
+ LC_OBJECT_KEY *next[32], *prev[32], *node;
int i, empty = m_nKeyInfoCount;
for (i = 0; i < m_nKeyInfoCount; i++)