本文整理汇总了C++中Log_Write函数的典型用法代码示例。如果您正苦于以下问题:C++ Log_Write函数的具体用法?C++ Log_Write怎么用?C++ Log_Write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Log_Write函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AAS_CheckAreaSharedFaces
//===========================================================================
// checks the number of shared faces between the given two areas
// since areas are convex they should only have ONE shared face
// however due to crappy face merging there are sometimes several
// shared faces
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_CheckAreaSharedFaces(tmp_area_t *tmparea1, tmp_area_t *tmparea2)
{
int numsharedfaces, side;
tmp_face_t *face1, *sharedface;
if (tmparea1->invalid || tmparea2->invalid) return;
sharedface = NULL;
numsharedfaces = 0;
for (face1 = tmparea1->tmpfaces; face1; face1 = face1->next[side])
{
side = face1->frontarea != tmparea1;
if (face1->backarea == tmparea2 || face1->frontarea == tmparea2)
{
sharedface = face1;
numsharedfaces++;
} //end if
} //end if
if (!sharedface) return;
//the areas should only have one shared face
if (numsharedfaces > 1)
{
Log_Write("---- tmp area %d and %d have %d shared faces\r\n",
tmparea1->areanum, tmparea2->areanum, numsharedfaces);
for (face1 = tmparea1->tmpfaces; face1; face1 = face1->next[side])
{
side = face1->frontarea != tmparea1;
if (face1->backarea == tmparea2 || face1->frontarea == tmparea2)
{
Log_Write("face %d, planenum = %d, face->frontarea = %d face->backarea = %d\r\n",
face1->num, face1->planenum, face1->frontarea->areanum, face1->backarea->areanum);
} //end if
} //end if
} //end if
} //end of the function AAS_CheckAreaSharedFaces
示例2: AAS_CreateAreas
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_CreateAreas( node_t *node ) {
Log_Write( "AAS_CreateAreas\r\n" );
qprintf( "%6d areas created", 0 );
tmpaasworld.nodes = AAS_CreateAreas_r( node );
qprintf( "\n" );
Log_Write( "%6d areas created\r\n", tmpaasworld.numareas );
} //end of the function AAS_CreateAreas
示例3: AAS_RemoveTinyFaces
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_RemoveTinyFaces(void)
{
int side, num;
tmp_face_t *face, *nextface;
tmp_area_t *tmparea;
//FIXME: loop over the faces instead of area->faces
Log_Write("AAS_RemoveTinyFaces\r\n");
num = 0;
for (tmparea = tmpaasworld.areas; tmparea; tmparea = tmparea->l_next)
{
for (face = tmparea->tmpfaces; face; face = nextface)
{
side = face->frontarea != tmparea;
nextface = face->next[side];
//
if (WindingArea(face->winding) < 1)
{
if (face->frontarea) AAS_RemoveFaceFromArea(face, face->frontarea);
if (face->backarea) AAS_RemoveFaceFromArea(face, face->backarea);
AAS_FreeTmpFace(face);
//Log_Write("area %d face %d is tiny\r\n", tmparea->areanum, face->num);
num++;
} //end if
} //end for
} //end for
Log_Write("%d tiny faces removed\r\n", num);
} //end of the function AAS_RemoveTinyFaces
示例4: AAS_MergeAreaPlaneFaces
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_MergeAreaPlaneFaces( void ) {
int num_facemerges = 0;
int side1;
tmp_area_t *tmparea, *nexttmparea;
tmp_face_t *face1;
Log_Write( "AAS_MergePlaneFaces\r\n" );
qprintf( "%6d plane face merges", num_facemerges );
//NOTE: first convex area is a dummy
for ( tmparea = tmpaasworld.areas; tmparea; tmparea = nexttmparea )
{
nexttmparea = tmparea->l_next;
//
if ( tmparea->invalid ) {
continue;
}
//
for ( face1 = tmparea->tmpfaces; face1; face1 = face1->next[side1] )
{
side1 = face1->frontarea != tmparea;
//
if ( AAS_CanMergePlaneFaces( tmparea, face1->planenum ) ) {
AAS_MergePlaneFaces( tmparea, face1->planenum );
nexttmparea = tmparea;
num_facemerges++;
qprintf( "\r%6d", num_facemerges );
break;
} //end if
} //end for
} //end for
qprintf( "\n" );
Log_Write( "%6d plane face merges\r\n", num_facemerges );
} //end of the function AAS_MergeAreaPlaneFaces
示例5: FindQuakeFile2
//===========================================================================
// find a Quake2 file
// returns full path in 'filename'
// sets offset and length of the file
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
qboolean FindQuakeFile2( char *basedir, char *gamedir, char *filename, foundfile_t *file ) {
int dir, i;
//NOTE: 3 is necessary (LCC bug???)
char gamedirs[3][MAX_PATH] = {"","",""};
char filedir[MAX_PATH] = "";
//
if ( gamedir ) {
strncpy( gamedirs[0], gamedir, MAX_PATH );
}
strncpy( gamedirs[1], "baseq2", MAX_PATH );
//
//find the file in the two game directories
for ( dir = 0; dir < 2; dir++ )
{
//check if the file is in a directory
filedir[0] = 0;
if ( basedir && strlen( basedir ) ) {
strncpy( filedir, basedir, MAX_PATH );
AppendPathSeperator( filedir, MAX_PATH );
} //end if
if ( strlen( gamedirs[dir] ) ) {
strncat( filedir, gamedirs[dir], MAX_PATH - strlen( filedir ) );
AppendPathSeperator( filedir, MAX_PATH );
} //end if
strncat( filedir, filename, MAX_PATH - strlen( filedir ) );
ConvertPath( filedir );
Log_Write( "accessing %s", filedir );
if ( !access( filedir, 0x04 ) ) {
strcpy( file->filename, filedir );
file->length = 0;
file->offset = 0;
return true;
} //end if
//check if the file is in a pak?.pak
for ( i = 0; i < 10; i++ )
{
filedir[0] = 0;
if ( basedir && strlen( basedir ) ) {
strncpy( filedir, basedir, MAX_PATH );
AppendPathSeperator( filedir, MAX_PATH );
} //end if
if ( strlen( gamedirs[dir] ) ) {
strncat( filedir, gamedirs[dir], MAX_PATH - strlen( filedir ) );
AppendPathSeperator( filedir, MAX_PATH );
} //end if
sprintf( &filedir[strlen( filedir )], "pak%d.pak", i );
if ( !access( filedir, 0x04 ) ) {
Log_Write( "searching %s in %s", filename, filedir );
if ( FindFileInPak( filedir, filename, file ) ) {
return true;
}
} //end if
} //end for
} //end for
file->offset = 0;
file->length = 0;
return false;
} //end of the function FindQuakeFile2
示例6: AAS_GravitationalSubdivision
//===========================================================================
// NOTE: merge faces and melt edges first
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_GravitationalSubdivision( void ) {
Log_Write( "AAS_GravitationalSubdivision\r\n" );
numgravitationalsubdivisions = 0;
qprintf( "%6i gravitational subdivisions", numgravitationalsubdivisions );
//start with the head node
AAS_GravitationalSubdivision_r( tmpaasworld.nodes );
qprintf( "\n" );
Log_Write( "%6i gravitational subdivisions\r\n", numgravitationalsubdivisions );
} //end of the function AAS_GravitationalSubdivision
示例7: AAS_GetFace
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
qboolean AAS_GetFace(winding_t *w, plane_t *p, int side, int *facenum)
{
int edgenum, i, j;
aas_face_t *face;
//face zero is a dummy, because of the face index with negative numbers
if ((*aasworld).numfaces == 0)
{
(*aasworld).numfaces = 1;
}
if ((*aasworld).numfaces >= max_aas.max_faces)
{
Error("AAS_MAX_FACES = %d", max_aas.max_faces);
} //end if
face = &(*aasworld).faces[(*aasworld).numfaces];
AAS_GetPlane(p->normal, p->dist, &face->planenum);
face->faceflags = 0;
face->firstedge = (*aasworld).edgeindexsize;
face->frontarea = 0;
face->backarea = 0;
face->numedges = 0;
for (i = 0; i < w->numpoints; i++)
{
if ((*aasworld).edgeindexsize >= max_aas.max_edgeindexsize)
{
Error("AAS_MAX_EDGEINDEXSIZE = %d", max_aas.max_edgeindexsize);
} //end if
j = (i + 1) % w->numpoints;
AAS_GetEdge(w->p[i], w->p[j], &edgenum);
//if the edge wasn't degenerate
if (edgenum)
{
(*aasworld).edgeindex[(*aasworld).edgeindexsize++] = edgenum;
face->numedges++;
} //end if
else if (verbose)
{
Log_Write("AAS_GetFace: face %d had degenerate edge %d-%d\r\n",
(*aasworld).numfaces, i, j);
} //end else
} //end for
if (face->numedges < 1
#ifdef NOTHREEVERTEXFACES
|| face->numedges < 3
#endif //NOTHREEVERTEXFACES
)
{
memset(&(*aasworld).faces[(*aasworld).numfaces], 0, sizeof(aas_face_t));
Log_Write("AAS_GetFace: face %d was tiny\r\n", (*aasworld).numfaces);
return false;
} //end if
*facenum = (*aasworld).numfaces;
(*aasworld).numfaces++;
return true;
} //end of the function AAS_GetFace
示例8: AAS_LadderSubdivision
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_LadderSubdivision( void ) {
Log_Write( "AAS_LadderSubdivision\r\n" );
numladdersubdivisions = 0;
qprintf( "%6i ladder subdivisions", numladdersubdivisions );
//start with the head node
AAS_LadderSubdivision_r( tmpaasworld.nodes );
//
qprintf( "\n" );
Log_Write( "%6i ladder subdivisions\r\n", numladdersubdivisions );
} //end of the function AAS_LadderSubdivision
示例9: AAS_CheckArea
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_CheckArea(tmp_area_t *tmparea)
{
int side;
tmp_face_t *face;
plane_t *plane;
vec3_t wcenter, acenter = {0, 0, 0};
vec3_t normal;
float n, dist;
if (tmparea->invalid) Log_Print("AAS_CheckArea: invalid area\n");
for (n = 0, face = tmparea->tmpfaces; face; face = face->next[side])
{
//side of the face the area is on
side = face->frontarea != tmparea;
WindingCenter(face->winding, wcenter);
VectorAdd(acenter, wcenter, acenter);
n++;
} //end for
n = 1 / n;
VectorScale(acenter, n, acenter);
for (face = tmparea->tmpfaces; face; face = face->next[side])
{
//side of the face the area is on
side = face->frontarea != tmparea;
#ifdef L_DEBUG
if (WindingError(face->winding))
{
Log_Write("AAS_CheckArea: area %d face %d: %s\r\n", tmparea->areanum,
face->num, WindingErrorString());
} //end if
#endif
plane = &mapplanes[face->planenum ^ side];
if (DotProduct(plane->normal, acenter) - plane->dist < 0)
{
Log_Print("AAS_CheckArea: area %d face %d is flipped\n", tmparea->areanum, face->num);
Log_Print("AAS_CheckArea: area %d center is %f %f %f\n", tmparea->areanum, acenter[0], acenter[1], acenter[2]);
} //end if
//check if the winding plane is the same as the face plane
WindingPlane(face->winding, normal, &dist);
plane = &mapplanes[face->planenum];
#ifdef L_DEBUG
if (fabs(dist - plane->dist) > 0.4 ||
fabs(normal[0] - plane->normal[0]) > 0.0001 ||
fabs(normal[1] - plane->normal[1]) > 0.0001 ||
fabs(normal[2] - plane->normal[2]) > 0.0001)
{
Log_Write("AAS_CheckArea: area %d face %d winding plane unequal to face plane\r\n",
tmparea->areanum, face->num);
} //end if
#endif
} //end for
} //end of the function AAS_CheckArea
示例10: AAS_CheckFaceWindingPlane
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_CheckFaceWindingPlane(tmp_face_t *face)
{
float dist, sign1, sign2;
vec3_t normal;
plane_t *plane;
winding_t *w;
//check if the winding plane is the same as the face plane
WindingPlane(face->winding, normal, &dist);
plane = &mapplanes[face->planenum];
//
sign1 = DotProduct(plane->normal, normal);
//
if(fabs(dist - plane->dist) > 0.4 ||
fabs(normal[0] - plane->normal[0]) > 0.0001 ||
fabs(normal[1] - plane->normal[1]) > 0.0001 ||
fabs(normal[2] - plane->normal[2]) > 0.0001)
{
VectorInverse(normal);
dist = -dist;
if(fabs(dist - plane->dist) > 0.4 ||
fabs(normal[0] - plane->normal[0]) > 0.0001 ||
fabs(normal[1] - plane->normal[1]) > 0.0001 ||
fabs(normal[2] - plane->normal[2]) > 0.0001)
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding plane unequal to face plane\r\n",
face->num);
//
sign2 = DotProduct(plane->normal, normal);
if((sign1 < 0 && sign2 > 0) ||
(sign1 > 0 && sign2 < 0))
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding reversed\r\n",
face->num);
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
} //end if
} //end if
else
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding reversed\r\n",
face->num);
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
} //end else
} //end if
} //end of the function AAS_CheckFaceWindingPlane
示例11: AAS_StoreFile
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_StoreFile( char *filename ) {
AAS_AllocMaxAAS();
Log_Write( "AAS_StoreFile\r\n" );
//
AAS_StoreBoundingBoxes();
//
qprintf( "%6d areas stored", 0 );
//start with node 1 because node zero is a dummy
AAS_StoreTree_r( tmpaasworld.nodes );
qprintf( "\n" );
Log_Write( "%6d areas stored\r\n", ( *aasworld ).numareas );
( *aasworld ).loaded = true;
} //end of the function AAS_StoreFile
示例12: Mem_DumpLeaks
void Mem_DumpLeaks()
{
struct memrec_s *next;
unsigned int totalleak = 0;
struct fileleak_s *files = NULL;
int i;
for (i=0; i<64; i++)
{
next = allocs[i];
while (next->next != allocs[i])
{
struct fileleak_s *find = files;
while (find && strcmp(find->name, next->next->file) != 0)
{
find = find->next;
}
if (find)
{
find->size += next->next->size;
}
else
{
find = malloc(sizeof(*find));
find->name = strdup(next->next->file);
find->size = next->next->size;
find->next = files;
files = find;
}
Log_Write(0, "Leaked allocation, type %s\nat %s:%d\npointer %d size %d\n", next->next->objecttype, next->next->file, next->next->line, next->next->pointer, next->next->size);
totalleak += next->next->size;
next = next->next;
}
}
while(files)
{
Log_Write(0, "Total leaked in %s: %d\n", files->name, files->size);
free(files->name);
files = files->next;
}
Log_Write(0, "Total leaked: %d\n", totalleak);
}
示例13: AAS_SplitFace
//===========================================================================
// NOTE: the original face is invalid after splitting
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_SplitFace(tmp_face_t *face, vec3_t normal, float dist,
tmp_face_t **frontface, tmp_face_t **backface)
{
winding_t *frontw, *backw;
//
*frontface = *backface = NULL;
ClipWindingEpsilon(face->winding, normal, dist, FACECLIP_EPSILON, &frontw, &backw);
#ifdef DEBUG
//
if (frontw)
{
if (WindingIsTiny(frontw))
{
Log_Write("AAS_SplitFace: tiny back face\r\n");
FreeWinding(frontw);
frontw = NULL;
} //end if
} //end if
if (backw)
{
if (WindingIsTiny(backw))
{
Log_Write("AAS_SplitFace: tiny back face\r\n");
FreeWinding(backw);
backw = NULL;
} //end if
} //end if
#endif //DEBUG
//if the winding was split
if (frontw)
{
//check bounds
(*frontface) = AAS_AllocTmpFace();
(*frontface)->planenum = face->planenum;
(*frontface)->winding = frontw;
(*frontface)->faceflags = face->faceflags;
} //end if
if (backw)
{
//check bounds
(*backface) = AAS_AllocTmpFace();
(*backface)->planenum = face->planenum;
(*backface)->winding = backw;
(*backface)->faceflags = face->faceflags;
} //end if
} //end of the function AAS_SplitFace
示例14: AAS_MeltAreaFaceWindings
//===========================================================================
// melt the windings of the faces of all areas
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_MeltAreaFaceWindings( void ) {
tmp_area_t *tmparea;
int num_windingsplits = 0;
Log_Write( "AAS_MeltAreaFaceWindings\r\n" );
qprintf( "%6d edges melted", num_windingsplits );
//NOTE: first convex area (zero) is a dummy
for ( tmparea = tmpaasworld.areas; tmparea; tmparea = tmparea->l_next )
{
num_windingsplits += AAS_MeltFaceWindingsOfArea( tmparea );
qprintf( "\r%6d", num_windingsplits );
} //end for
qprintf( "\n" );
Log_Write( "%6d edges melted\r\n", num_windingsplits );
} //end of the function AAS_MeltAreaFaceWindings
示例15: AAS_MergeAreaFaces
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_MergeAreaFaces(void)
{
int num_facemerges = 0;
int side1, side2, restart;
tmp_area_t *tmparea, *lasttmparea;
tmp_face_t *face1, *face2;
Log_Write("AAS_MergeAreaFaces\r\n");
qprintf("%6d face merges", num_facemerges);
//NOTE: first convex area is a dummy
lasttmparea = tmpaasworld.areas;
for (tmparea = tmpaasworld.areas; tmparea; tmparea = tmparea->l_next)
{
restart = false;
//
if (tmparea->invalid)
{
continue;
}
//
for (face1 = tmparea->tmpfaces; face1; face1 = face1->next[side1])
{
side1 = face1->frontarea != tmparea;
for (face2 = face1->next[side1]; face2; face2 = face2->next[side2])
{
side2 = face2->frontarea != tmparea;
//if succesfully merged
if (AAS_TryMergeFaces(face1, face2))
{
//start over again after merging two faces
restart = true;
num_facemerges++;
qprintf("\r%6d", num_facemerges);
AAS_CheckArea(tmparea);
break;
} //end if
} //end for
if (restart)
{
tmparea = lasttmparea;
break;
} //end if
} //end for
lasttmparea = tmparea;
} //end for
qprintf("\n");
Log_Write("%6d face merges\r\n", num_facemerges);
} //end of the function AAS_MergeAreaFaces