diff options
-rw-r--r-- | Magic2/Editor.cpp | 2 | ||||
-rw-r--r-- | Magic2/Grid.cpp | 6 | ||||
-rw-r--r-- | Magic2/GridProps.cpp | 6 | ||||
-rw-r--r-- | Magic2/Magic.cpp | 10 | ||||
-rw-r--r-- | Magic2/Magic.vcxproj | 2 | ||||
-rw-r--r-- | Magic2/MagicDoc.cpp | 4 | ||||
-rw-r--r-- | Magic2/MagicView.cpp | 8 | ||||
-rw-r--r-- | Magic2/MaterialDialog.cpp | 12 | ||||
-rw-r--r-- | Magic2/ModelFile3DS.cpp | 8 | ||||
-rw-r--r-- | Magic2/ModelFileMAG.cpp | 11 | ||||
-rw-r--r-- | Magic2/ModelFileOBJ.cpp | 2 | ||||
-rw-r--r-- | Magic2/Selection.cpp | 2 | ||||
-rw-r--r-- | Magic2/Selector.cpp | 12 | ||||
-rw-r--r-- | Magic2/SurfacePropertiesDialog.cpp | 14 | ||||
-rw-r--r-- | Magic2/l3ds.cpp | 4 |
15 files changed, 53 insertions, 50 deletions
diff --git a/Magic2/Editor.cpp b/Magic2/Editor.cpp index c8e35be..cfaf40d 100644 --- a/Magic2/Editor.cpp +++ b/Magic2/Editor.cpp @@ -336,7 +336,7 @@ Editor::Resegment() // create new cohesive segments:
Segment* segment = 0;
- for (n = 0; n < npolys; n++) {
+ for (int n = 0; n < npolys; n++) {
if (segment && segment->material == polys[n].material) {
segment->npolys++;
}
diff --git a/Magic2/Grid.cpp b/Magic2/Grid.cpp index b00767c..3499591 100644 --- a/Magic2/Grid.cpp +++ b/Magic2/Grid.cpp @@ -145,7 +145,7 @@ Grid::Render(Video* video, DWORD flags) origin[2].y += -EXTENT;
origin[3].y += EXTENT;
- for (i = 0; i < 2*MAJOR_COUNT; i += 2) {
+ for (int i = 0; i < 2*MAJOR_COUNT; i += 2) {
float x = (float) (i-MAJOR_COUNT) * 64.0f;
float y = (float) (i-MAJOR_COUNT) * 64.0f;
@@ -163,7 +163,7 @@ Grid::Render(Video* video, DWORD flags) origin[2].z += -EXTENT;
origin[3].z += EXTENT;
- for (i = 0; i < 2*MAJOR_COUNT; i += 2) {
+ for (int i = 0; i < 2*MAJOR_COUNT; i += 2) {
float x = (float) (i-MAJOR_COUNT) * 64.0f;
float z = (float) (i-MAJOR_COUNT) * 64.0f;
@@ -181,7 +181,7 @@ Grid::Render(Video* video, DWORD flags) origin[2].z += -EXTENT;
origin[3].z += EXTENT;
- for (i = 0; i < 2*MAJOR_COUNT; i += 2) {
+ for (int i = 0; i < 2*MAJOR_COUNT; i += 2) {
float y = (float) (i-MAJOR_COUNT) * 64.0f;
float z = (float) (i-MAJOR_COUNT) * 64.0f;
diff --git a/Magic2/GridProps.cpp b/Magic2/GridProps.cpp index 8b252ec..d375ea9 100644 --- a/Magic2/GridProps.cpp +++ b/Magic2/GridProps.cpp @@ -44,10 +44,10 @@ GridProps::GridProps(Grid* g, CWnd* pParent /*=NULL*/) static const char* C(CString& str)
{
static char buf[512];
-
- for (int i = 0; i < str.GetLength(); i++)
+ int i;
+ for (i = 0; i < str.GetLength(); i++)
buf[i] = (char) str.GetAt(i);
- buf[i] = 0;
+ buf[i] = 0;
return buf;
}
diff --git a/Magic2/Magic.cpp b/Magic2/Magic.cpp index 63142db..d9d626a 100644 --- a/Magic2/Magic.cpp +++ b/Magic2/Magic.cpp @@ -92,11 +92,11 @@ BOOL Magic::InitInstance() // of your final executable, you should remove from the following
// the specific initialization routines you do not need.
-#ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
-#else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
-#endif
+//#ifdef _AFXDLL
+// Enable3dControls(); // Call this when using MFC in a shared DLL
+//#else
+// Enable3dControlsStatic(); // Call this when linking to MFC statically
+//#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
diff --git a/Magic2/Magic.vcxproj b/Magic2/Magic.vcxproj index 7824182..110b1cd 100644 --- a/Magic2/Magic.vcxproj +++ b/Magic2/Magic.vcxproj @@ -42,11 +42,13 @@ <OutDir>.\Debug\</OutDir>
<IntDir>.\Debug\</IntDir>
<LinkIncremental>true</LinkIncremental>
+ <IncludePath>..\oggvorbis\include;$(DXSDK_DIR)\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\Release\</OutDir>
<IntDir>.\Release\</IntDir>
<LinkIncremental>true</LinkIncremental>
+ <IncludePath>$(DXSDK_DIR)\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
diff --git a/Magic2/MagicDoc.cpp b/Magic2/MagicDoc.cpp index 640fa41..7b8e6f8 100644 --- a/Magic2/MagicDoc.cpp +++ b/Magic2/MagicDoc.cpp @@ -500,7 +500,7 @@ int LoadTexture(const char* fname, Bitmap*& bitmap, int type) }
if (found) {
- strcat(tmp, "+.pcx");
+ strcat_s(tmp, "+.pcx");
if (pcx.Load(tmp) == PCX_OK && pcx.himap != 0) {
bitmap->CopyHighColorImage(pcx.width, pcx.height, pcx.himap);
}
@@ -544,7 +544,7 @@ int LoadAlpha(const char* name, Bitmap& bitmap, int type) // check for an associated alpha-only (grayscale) bitmap:
char filename[256];
- strcpy(filename, name);
+ strcpy_s(filename, name);
char* dot = strrchr(filename, '.');
if (dot && pcx_file)
diff --git a/Magic2/MagicView.cpp b/Magic2/MagicView.cpp index c97e641..294c794 100644 --- a/Magic2/MagicView.cpp +++ b/Magic2/MagicView.cpp @@ -787,7 +787,7 @@ void MagicView::OnFileImport() return;
char mag_name[256];
- sprintf(mag_name, "%s", ofd.GetFileName().GetBuffer(0));
+ sprintf_s(mag_name, "%s", ofd.GetFileName().GetBuffer(0));
MagicDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
@@ -814,7 +814,7 @@ void MagicView::OnFileExport() return;
char mag_name[256];
- sprintf(mag_name, "%s", ofd.GetFileName().GetBuffer(0));
+ sprintf_s(mag_name, "%s", ofd.GetFileName().GetBuffer(0));
MagicDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
@@ -1115,9 +1115,9 @@ void MagicView::OnMouseMove(UINT nFlags, CPoint point) int np = seln ? seln->GetPolys().size() : 0;
if (np || nv)
- sprintf(xy, "(%05d,%05d) Verts:%d Polys:%d", mouse.x, mouse.y, nv, np);
+ sprintf_s(xy, "(%05d,%05d) Verts:%d Polys:%d", mouse.x, mouse.y, nv, np);
else
- sprintf(xy, "(%05d,%05d)", mouse.x, mouse.y);
+ sprintf_s(xy, "(%05d,%05d)", mouse.x, mouse.y);
MainFrame::StatusXY(xy);
}
diff --git a/Magic2/MaterialDialog.cpp b/Magic2/MaterialDialog.cpp index 1da19d9..1acef19 100644 --- a/Magic2/MaterialDialog.cpp +++ b/Magic2/MaterialDialog.cpp @@ -188,8 +188,8 @@ void MaterialDialog::UpdateMaterial() if (material) {
UpdateData();
- strcpy(material->name, mMaterialName);
- strcpy(material->shader, mMaterialShader);
+ strcpy_s(material->name, mMaterialName);
+ strcpy_s(material->shader, mMaterialShader);
material->ambient_value = mAmbientValue;
material->diffuse_value = mDiffuseValue;
@@ -381,7 +381,7 @@ void MaterialDialog::OnFileTexture(int type) return;
char tex_name[512];
- sprintf(tex_name, "%s", ofd.GetFileName().GetBuffer(0));
+ sprintf_s(tex_name, "%s", ofd.GetFileName().GetBuffer(0));
ChangeFileTexture(tex_name, type);
}
@@ -514,7 +514,7 @@ void MaterialDialog::OnChangeMaterialName() {
if (material) {
UpdateData();
- strcpy(material->name, mMaterialName);
+ strcpy_s(material->name, mMaterialName);
}
}
@@ -522,7 +522,7 @@ void MaterialDialog::OnChangeMaterialShader() {
if (material) {
UpdateData();
- strcpy(material->shader, mMaterialShader);
+ strcpy_s(material->shader, mMaterialShader);
}
}
@@ -597,7 +597,7 @@ void MaterialDialog::OnNewMaterial() mtl->diffuse_color = Color::LightGray;
mtl->specular_value = 0.5f;
mtl->specular_color = Color::White;
- strcpy(mtl->name, "(new)");
+ strcpy_s(mtl->name, "(new)");
model->GetMaterials().append(mtl);
diff --git a/Magic2/ModelFile3DS.cpp b/Magic2/ModelFile3DS.cpp index f4381bb..db309ba 100644 --- a/Magic2/ModelFile3DS.cpp +++ b/Magic2/ModelFile3DS.cpp @@ -151,11 +151,11 @@ ModelFile3DS::Load(Model* model, double scale) float radius = 0;
int v = 0;
- for (m = 0; m < nmeshs && v < nverts; m++) {
+ for (int m = 0; m < nmeshs && v < nverts; m++) {
LMesh& mesh = loader.GetMesh(m);
// read vertex set:
- for (i = 0; i < mesh.GetVertexCount() && v < nverts; i++) {
+ for (int i = 0; i < mesh.GetVertexCount() && v < nverts; i++) {
vset->loc[v].x = mesh.GetVertex(i).x;
vset->loc[v].y = mesh.GetVertex(i).z;
vset->loc[v].z = mesh.GetVertex(i).y;
@@ -182,7 +182,7 @@ ModelFile3DS::Load(Model* model, double scale) int n = 0;
- for (m = 0; m < nmeshs && n < npolys; m++) {
+ for (int m = 0; m < nmeshs && n < npolys; m++) {
LMesh& mesh = loader.GetMesh(m);
// read polys:
@@ -228,7 +228,7 @@ ModelFile3DS::Load(Model* model, double scale) // then assign them to cohesive segments:
Segment* segment = 0;
- for (n = 0; n < npolys; n++) {
+ for (int n = 0; n < npolys; n++) {
if (segment && segment->material == polys[n].material) {
segment->npolys++;
}
diff --git a/Magic2/ModelFileMAG.cpp b/Magic2/ModelFileMAG.cpp index 829d5e1..ff9ed7e 100644 --- a/Magic2/ModelFileMAG.cpp +++ b/Magic2/ModelFileMAG.cpp @@ -78,7 +78,7 @@ ModelFileMAG::Load(Model* m, double scale) }
ZeroMemory(pname, 64);
- strncpy(pname, filename, 63);
+ strncpy_s(pname, filename, 63);
char file_id[5];
fread(file_id, 4, 1, fp);
@@ -380,7 +380,7 @@ ModelFileMAG::LoadMag5(FILE* fp, Model* m, double scale) mtl->diffuse_color = Color::LightGray;
mtl->specular_value = 0.5f;
mtl->specular_color = Color::White;
- strcpy(mtl->name, "(default)");
+ strcpy_s(mtl->name, "(default)");
m->GetMaterials().append(mtl);
}
@@ -405,7 +405,7 @@ ModelFileMAG::LoadMag5(FILE* fp, Model* m, double scale) fread(tname, 32, 1, fp);
LoadTexture(tname, mtl->tex_diffuse, Bitmap::BMP_SOLID);
- strcpy(mtl->name, tname);
+ strcpy_s(mtl->name, tname);
char* dot = strrchr(mtl->name, '.');
if (dot)
@@ -450,7 +450,8 @@ ModelFileMAG::LoadMag5(FILE* fp, Model* m, double scale) ZeroMemory(vset->rw, nverts * sizeof(float));
// read vertex set:
- for (int v = 0; v < mag_nverts; v++) {
+ int v;
+ for (v = 0; v < mag_nverts; v++) {
Vec3 vert, norm;
DWORD vstate;
@@ -789,7 +790,7 @@ ModelFileMAG::LoadMag6(FILE* fp, Model* m, double scale) // then assign them to cohesive segments:
Segment* segment = 0;
- for (n = 0; n < npolys; n++) {
+ for (int n = 0; n < npolys; n++) {
if (segment && segment->material == polys[n].material) {
segment->npolys++;
}
diff --git a/Magic2/ModelFileOBJ.cpp b/Magic2/ModelFileOBJ.cpp index 8226d22..ee618b7 100644 --- a/Magic2/ModelFileOBJ.cpp +++ b/Magic2/ModelFileOBJ.cpp @@ -90,7 +90,7 @@ static void ParsePoly(const char* line, ObjFace* face) while (isspace(*p))
p++;
- i = 0;
+ int i = 0;
while (*p && i < MAX_OBJ_FACE_VERTS) {
int factor = 1;
diff --git a/Magic2/Selection.cpp b/Magic2/Selection.cpp index 1345c11..1c69129 100644 --- a/Magic2/Selection.cpp +++ b/Magic2/Selection.cpp @@ -29,7 +29,7 @@ Selection::Selection()
: model(0), model_view(0)
{
- strcpy(name, "Selection");
+ strcpy_s(name, "Selection");
}
// +--------------------------------------------------------------------+
diff --git a/Magic2/Selector.cpp b/Magic2/Selector.cpp index f0338ac..c79f813 100644 --- a/Magic2/Selector.cpp +++ b/Magic2/Selector.cpp @@ -35,7 +35,7 @@ Selector::Selector(Selection* s) own_selection = true;
}
- strcpy(name, "Selector");
+ strcpy_s(name, "Selector");
}
Selector::~Selector()
@@ -185,7 +185,7 @@ Selector::End() }
// find all selected polys:
- for (i = 0; i < s->NumPolys(); i++) {
+ for (int i = 0; i < s->NumPolys(); i++) {
Poly* poly = s->GetPolys() + i;
bool will_select = true;
@@ -230,7 +230,7 @@ Selector::SelectAll(int select_mode) selection->GetPolys().append(s->GetPolys() + i);
}
- for (i = 0; i < s->NumVerts(); i++) {
+ for (int i = 0; i < s->NumVerts(); i++) {
DWORD value = (iter.index() << 16) | i;
selection->GetVerts().append(value);
}
@@ -259,7 +259,7 @@ Selector::SelectInverse() selection->AddPoly(p);
}
- for (i = 0; i < s->NumVerts(); i++) {
+ for (int i = 0; i < s->NumVerts(); i++) {
if (selection->Contains(s_index, i))
selection->RemoveVert(s_index, i);
else
@@ -284,7 +284,7 @@ Selector::SelectSurface(Surface* s, int select_mode) selection->RemovePoly(s->GetPolys() + i);
}
- for (i = 0; i < s->NumVerts(); i++) {
+ for (int i = 0; i < s->NumVerts(); i++) {
selection->RemoveVert(index, i);
}
}
@@ -293,7 +293,7 @@ Selector::SelectSurface(Surface* s, int select_mode) selection->AddPoly(s->GetPolys() + i);
}
- for (i = 0; i < s->NumVerts(); i++) {
+ for (int i = 0; i < s->NumVerts(); i++) {
selection->AddVert(index, i);
}
}
diff --git a/Magic2/SurfacePropertiesDialog.cpp b/Magic2/SurfacePropertiesDialog.cpp index 267f7e6..d6fd7f4 100644 --- a/Magic2/SurfacePropertiesDialog.cpp +++ b/Magic2/SurfacePropertiesDialog.cpp @@ -43,25 +43,25 @@ SurfacePropertiesDialog::SurfacePropertiesDialog(MagicView* pParent /*=NULL*/) surface->GetVertexSet()->CalcExtents(plus, minus);
char buffer[256];
- strcpy(buffer, surface->Name());
+ strcpy_s(buffer, surface->Name());
mSurfaceName = buffer;
- sprintf(buffer, "%d", surface->NumPolys());
+ sprintf_s(buffer, "%d", surface->NumPolys());
mNumPolys = buffer;
- sprintf(buffer, "%d", surface->NumVerts());
+ sprintf_s(buffer, "%d", surface->NumVerts());
mNumVerts = buffer;
- sprintf(buffer, "%.1f", surface->Radius());
+ sprintf_s(buffer, "%.1f", surface->Radius());
mSurfaceRadius = buffer;
- sprintf(buffer, "%.1f (%.1f - %.1f)", plus.z-minus.z, minus.z, plus.z);
+ sprintf_s(buffer, "%.1f (%.1f - %.1f)", plus.z-minus.z, minus.z, plus.z);
mSurfaceLength = buffer;
- sprintf(buffer, "%.1f (%.1f - %.1f)", plus.x-minus.x, minus.x, plus.x);
+ sprintf_s(buffer, "%.1f (%.1f - %.1f)", plus.x-minus.x, minus.x, plus.x);
mSurfaceWidth = buffer;
- sprintf(buffer, "%.1f (%.1f - %.1f)", plus.y-minus.y, minus.y, plus.y);
+ sprintf_s(buffer, "%.1f (%.1f - %.1f)", plus.y-minus.y, minus.y, plus.y);
mSurfaceHeight = buffer;
}
}
diff --git a/Magic2/l3ds.cpp b/Magic2/l3ds.cpp index ac310af..dc93c2f 100644 --- a/Magic2/l3ds.cpp +++ b/Magic2/l3ds.cpp @@ -767,7 +767,7 @@ void LMesh::CalcTextureSpace() // now for each vertex build a list of face that share this vertex
std::vector< std::vector<int> > array;
array.resize(m_vertices.size());
- for (i=0; i<m_triangles.size(); i++)
+ for (int i=0; i<m_triangles.size(); i++)
{
uint k = m_tris[i].a;
array[k].push_back(i);
@@ -780,7 +780,7 @@ void LMesh::CalcTextureSpace() }
// now average the tangents and compute the binormals as (tangent X normal)
- for (i=0; i<m_vertices.size(); i++)
+ for (int i=0; i<m_vertices.size(); i++)
{
v1 = zero3;
v2 = zero3;
|