void CMeshSelectionConverter::AddSelectedVerts(void) { SSelectionColour* psSelectionColour; int iIndex; int iCornerNum; int iNumCorners; int iStartVertex; CArrayInt aiSkinIndices; BOOL bSelected; iStartVertex = mpcObject->GetNumberOfVerticesOfType(D3DFVF_CVERTEX); iNumCorners = 0; aiSkinIndices.Init(); for (iCornerNum = 0; iCornerNum < mpcMeshEditor->mcSelections.mcVerts.NumElements(); iCornerNum++) { bSelected = FixBool(mpcMeshEditor->mcSelections.mcVerts.Get(iCornerNum)); iIndex = mpcSelectionColours->FindWithIntKey(bSelected, 0); if (iIndex != -1) { iNumCorners++; psSelectionColour = mpcSelectionColours->Get(iIndex); AssignCorner(iCornerNum, psSelectionColour->iColour, mfZOffset*3, &aiSkinIndices); } } aiSkinIndices.Kill(); mpcObject->GrowPrimitive(iNumCorners, D3DPT_POINTLIST, iNumCorners, 0, miMaterialIndex, 0, 0); }
int CMeshSelections::GetNumberOfSelectedFaces(BOOL bSelected) { int i; int iCount; BOOL bCurrent; iCount = 0; for (i = 0; i < mcFaces.NumElements(); i++) { bCurrent = FixBool(mcFaces.Get(i)); if (bCurrent == bSelected) { iCount++; } } return iCount; }
void CMeshSelectionConverter::AddSelectedFaces(void) { int iFaceNum; CMeshFace* psFace; SSelectionColour* psSelectionColour; int iIndex; int iCornerOffset; CMeshCorner* psCorner; int iNumFaces; int iStartVertex; CArrayInt aiSkinIndices; int iColour; BOOL bSelected; iStartVertex = mpcObject->GetNumberOfVerticesOfType(D3DFVF_CVERTEX); iNumFaces = 0; aiSkinIndices.Init(); for (iFaceNum = 0; iFaceNum < mpcMeshEditor->mcSelections.mcFaces.NumElements(); iFaceNum++) { psFace = mpcMeshEditor->mpcMesh->GetFace(iFaceNum); bSelected = FixBool(mpcMeshEditor->mcSelections.mcFaces.Get(iFaceNum)); iIndex = mpcSelectionColours->FindWithIntKey(bSelected, 0); iNumFaces++; if (iIndex != -1) { psSelectionColour = mpcSelectionColours->Get(iIndex); iColour = psSelectionColour->iColour; } else { iColour = 0xff808080; } for (iCornerOffset = 0; iCornerOffset < NUM_FACE_CORNERS; iCornerOffset++) { psCorner = mpcMeshEditor->mpcMesh->GetCorner(psFace->asCorner[iCornerOffset]); AssignCorner(psFace->asCorner[iCornerOffset], iColour, mfZOffset, &aiSkinIndices); } } aiSkinIndices.Kill(); mpcObject->GrowPrimitive(iNumFaces, D3DPT_TRIANGLELIST, iNumFaces * 3, 0, miMaterialIndex, 0, 0); }
void CBaseObject::ValidateAllocation(void) { BOOL bDistToStackZero; BOOL bAllocateCalled; BOOL bInObjects; BOOL bAllSame; CChars sz; bDistToStackZero = GetDistToStack() == 0; bAllocateCalled = miFlags & OBJECT_FLAGS_CALLED_ALLOCATE; bAllocateCalled = FixBool(bAllocateCalled); bInObjects = IsAllocatedInObjects(); bAllSame = !bDistToStackZero == bAllocateCalled == bInObjects; if (!bAllSame) { sz.Init(); PrintObject(&sz, IsEmbedded()); gcLogger.Error2(__METHOD__, " Object {", sz.Text(), "} should not have a dist to stack of [", IntToString(GetDistToStack()), "] and flag OBJECT_FLAGS_CALLED_ALLOCATE [", IntToString(bAllocateCalled), "] and be allocated in Objects [0x", PointerToString(GetObjects()), "].", NULL); sz.Kill(); } }
void CMeshSelectionConverter::AddSelectedEdges(void) { int iEdgeNum; CMeshEdge* psEdge; SSelectionColour* psSelectionColour; int iIndex; int iCornerOffset; CMeshCorner* psCorner; int iNumEdges; int iStartVertex; CArrayInt aiSkinIndices; BOOL bSelected; iStartVertex = mpcObject->GetNumberOfVerticesOfType(D3DFVF_CVERTEX); iNumEdges = 0; aiSkinIndices.Init(); for (iEdgeNum = 0; iEdgeNum < mpcMeshEditor->mcSelections.mcEdges.NumElements(); iEdgeNum++) { bSelected = FixBool(mpcMeshEditor->mcSelections.mcEdges.Get(iEdgeNum)); iIndex = mpcSelectionColours->FindWithIntKey(bSelected, 0); if (iIndex != -1) { psEdge = mpcMeshEditor->mpcMesh->GetEdge(iEdgeNum); iNumEdges++; psSelectionColour = mpcSelectionColours->Get(iIndex); for (iCornerOffset = 0; iCornerOffset < NUM_EDGE_CORNERS; iCornerOffset++) { psCorner = mpcMeshEditor->mpcMesh->GetCorner(psEdge->aiCorner[iCornerOffset]); AssignCorner(psEdge->aiCorner[iCornerOffset], psSelectionColour->iColour, mfZOffset*2, &aiSkinIndices); } } } aiSkinIndices.Kill(); mpcObject->GrowPrimitive(iNumEdges, D3DPT_LINELIST, iNumEdges * 2, 0, miMaterialIndex, 0, 0); }
int FixBool(void* pv) { return FixBool((int)(ENGINE_SIZE_T) pv); }
////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////// int CMemoryFile::Eof(void) { return FixBool(iFlags & MEMORY_FILE_EOF_FLAG); }