本文整理汇总了C++中Log_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ Log_Print函数的具体用法?C++ Log_Print怎么用?C++ Log_Print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Log_Print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AAS_HashVec
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
unsigned AAS_HashVec( vec3_t vec ) {
int x, y;
x = ( MAX_MAP_BOUNDS + (int)( vec[0] + 0.5 ) ) >> VERTEX_HASH_SHIFT;
y = ( MAX_MAP_BOUNDS + (int)( vec[1] + 0.5 ) ) >> VERTEX_HASH_SHIFT;
if ( x < 0 || x >= VERTEX_HASH_SIZE || y < 0 || y >= VERTEX_HASH_SIZE ) {
Log_Print( "WARNING! HashVec: point %f %f %f outside valid range\n", vec[0], vec[1], vec[2] );
Log_Print( "This should never happen!\n" );
return -1;
} //end if
return y * VERTEX_HASH_SIZE + x;
} //end of the function AAS_HashVec
示例2: LoadCfgFile
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int LoadCfgFile( char *filename ) {
source_t *source;
token_t token;
int settingsdefined;
source = LoadSourceFile( filename );
if ( !source ) {
Log_Print( "couldn't open cfg file %s\n", filename );
return false;
} //end if
settingsdefined = false;
memset( &cfg, 0, sizeof( cfg_t ) );
while ( PC_ReadToken( source, &token ) )
{
if ( !stricmp( token.string, "bbox" ) ) {
if ( cfg.numbboxes >= AAS_MAX_BBOXES ) {
SourceError( source, "too many bounding box volumes defined" );
} //end if
if ( !ReadStructure( source, &bbox_struct, (char *) &cfg.bboxes[cfg.numbboxes] ) ) {
FreeSource( source );
return false;
} //end if
cfg.allpresencetypes |= cfg.bboxes[cfg.numbboxes].presencetype;
cfg.numbboxes++;
} //end if
else if ( !stricmp( token.string, "settings" ) ) {
if ( settingsdefined ) {
SourceWarning( source, "settings already defined\n" );
} //end if
settingsdefined = true;
if ( !ReadStructure( source, &cfg_struct, (char *) &cfg ) ) {
FreeSource( source );
return false;
} //end if
} //end else if
} //end while
if ( VectorLength( cfg.phys_gravitydirection ) < 0.9 || VectorLength( cfg.phys_gravitydirection ) > 1.1 ) {
SourceError( source, "invalid gravity direction specified" );
} //end if
if ( cfg.numbboxes <= 0 ) {
SourceError( source, "no bounding volumes specified" );
} //end if
FreeSource( source );
SetCfgLibVars();
Log_Print( "using cfg file %s\n", filename );
return true;
} //end of the function LoadCfgFile
示例3: Q2_LoadMapFile
/*
================
LoadMapFile
================
*/
void Q2_LoadMapFile(char *filename)
{
int i;
script_t *script;
Log_Print("-- Q2_LoadMapFile --\n");
#ifdef ME
//loaded map type
loadedmaptype = MAPTYPE_QUAKE2;
//reset the map loading
ResetMapLoading();
#endif //ME
script = LoadScriptFile(filename);
if (!script)
{
Log_Print("couldn't open %s\n", filename);
return;
} //end if
//white spaces and escape characters inside a string are not allowed
SetScriptFlags(script, SCFL_NOSTRINGWHITESPACES |
SCFL_NOSTRINGESCAPECHARS |
SCFL_PRIMITIVE);
nummapbrushsides = 0;
num_entities = 0;
while (Q2_ParseMapEntity(script))
{
}
ClearBounds (map_mins, map_maxs);
for (i=0 ; i<entities[0].numbrushes ; i++)
{
if (mapbrushes[i].mins[0] > 4096)
continue; // no valid points
AddPointToBounds (mapbrushes[i].mins, map_mins, map_maxs);
AddPointToBounds (mapbrushes[i].maxs, map_mins, map_maxs);
} //end for
PrintMapInfo();
//free the script
FreeScript(script);
// TestExpandBrushes ();
//
Q2_CreateMapTexinfo();
} //end of the function Q2_LoadMapFile
示例4: AAS_TestSplitPlane
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int AAS_TestSplitPlane(tmp_area_t *tmparea, vec3_t normal, float dist,
int *facesplits, int *groundsplits, int *epsilonfaces)
{
int j, side, front, back, planenum;
float d, d_front, d_back;
tmp_face_t *face;
winding_t *w;
*facesplits = *groundsplits = *epsilonfaces = 0;
planenum = FindFloatPlane(normal, dist);
w = AAS_SplitWinding(tmparea, planenum);
if (!w) return false;
FreeWinding(w);
//
for (face = tmparea->tmpfaces; face; face = face->next[side])
{
//side of the face the area is on
side = face->frontarea != tmparea;
if ((face->planenum & ~1) == (planenum & ~1))
{
Log_Print("AAS_TestSplitPlane: tried face plane as splitter\n");
return false;
} //end if
w = face->winding;
//reset distance at front and back side of plane
d_front = d_back = 0;
//reset front and back flags
front = back = 0;
for (j = 0; j < w->numpoints; j++)
{
d = DotProduct(w->p[j], normal) - dist;
if (d > d_front) d_front = d;
if (d < d_back) d_back = d;
if (d > 0.4) // PLANESIDE_EPSILON)
front = 1;
if (d < -0.4) // PLANESIDE_EPSILON)
back = 1;
} //end for
//check for an epsilon face
if ( (d_front > FACECLIP_EPSILON && d_front < FACE_EPSILON)
|| (d_back < -FACECLIP_EPSILON && d_back > -FACE_EPSILON) )
{
(*epsilonfaces)++;
} //end if
//if the face has points at both sides of the plane
if (front && back)
{
(*facesplits)++;
if (face->faceflags & FACE_GROUND)
{
(*groundsplits)++;
} //end if
} //end if
} //end for
return true;
} //end of the function AAS_TestSplitPlane
示例5: ThreadSetupLock
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void ThreadSetupLock( void ) {
Log_Print( "Win32 multi-threading\n" );
InitializeCriticalSection( &crit );
threaded = true; //Stupid me... forgot this!!!
currentnumthreads = 0;
currentthreadid = 0;
} //end of the function ThreadInitLock
示例6: ScriptWarning
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void QDECL ScriptWarning( script_t *script, const char *str, ... ) {
char text[1024];
va_list ap;
if ( script->flags & SCFL_NOWARNINGS ) {
return;
}
va_start( ap, str );
#if !defined RTCW_ET
vsprintf( text, str, ap );
#else
Q_vsnprintf( text, sizeof( text ), str, ap );
#endif // RTCW_XX
va_end( ap );
#ifdef BOTLIB
botimport.Print( PRT_WARNING, "file %s, line %d: %s\n", script->filename, script->line, text );
#endif //BOTLIB
#ifdef MEQCC
printf( "warning: file %s, line %d: %s\n", script->filename, script->line, text );
#endif //MEQCC
#ifdef BSPC
Log_Print( "warning: file %s, line %d: %s\n", script->filename, script->line, text );
#endif //BSPC
} //end of the function ScriptWarning
示例7: SetAreaPortalAreas_r
//===========================================================================
// Just decend the tree, and for each node that hasn't had an
// area set, flood fill out from there
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void SetAreaPortalAreas_r(node_t *node)
{
bspbrush_t *b;
entity_t *e;
if(node->planenum != PLANENUM_LEAF)
{
SetAreaPortalAreas_r(node->children[0]);
SetAreaPortalAreas_r(node->children[1]);
return;
} //end if
if(node->contents == CONTENTS_AREAPORTAL)
{
if(node->area)
{
return; // allready set
}
b = node->brushlist;
e = &entities[b->original->entitynum];
node->area = e->portalareas[0];
if(!e->portalareas[1])
{
Log_Print("WARNING: areaportal entity %i doesn't touch two areas\n", b->original->entitynum);
return;
} //end if
} //end if
} //end of the function SetAreaPortalAreas_r
示例8: ContentDir_Create
/*****************************************************************************
* ContentDir_Create
*****************************************************************************/
ContentDir*
ContentDir_Create (void* talloc_context,
UpnpClient_Handle ctrlpt_handle,
IXML_Element* serviceDesc,
const char* base_url)
{
OBJECT_SUPER_CONSTRUCT (ContentDir, Service_Create, talloc_context,
ctrlpt_handle, serviceDesc, base_url);
if (self == NULL)
goto error; // ---------->
if (CACHE_SIZE > 0 && CACHE_TIMEOUT > 0) {
self->cache = Cache_Create (self, CACHE_SIZE, CACHE_TIMEOUT,
cache_free_expired_data);
if (self->cache == NULL)
goto error; // ---------->
ithread_mutex_init (&self->cache_mutex, NULL);
}
return self; // ---------->
error:
Log_Print (LOG_ERROR, "ContentDir_Create error");
if (self)
talloc_free (self);
return NULL;
}
示例9: ThreadSetupLock
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void ThreadSetupLock(void)
{
pthread_mutexattr_t mattrib;
Log_Print("pthread multi-threading\n");
if (!my_mutex)
{
my_mutex = GetMemory(sizeof(*my_mutex));
if (pthread_mutexattr_create (&mattrib) == -1)
Error ("pthread_mutex_attr_create failed");
if (pthread_mutexattr_setkind_np (&mattrib, MUTEX_FAST_NP) == -1)
Error ("pthread_mutexattr_setkind_np failed");
if (pthread_mutex_init (my_mutex, mattrib) == -1)
Error ("pthread_mutex_init failed");
}
if (pthread_attr_create (&attrib) == -1)
Error ("pthread_attr_create failed");
if (pthread_attr_setstacksize (&attrib, 0x100000) == -1)
Error ("pthread_attr_setstacksize failed");
threaded = true;
currentnumthreads = 0;
currentthreadid = 0;
} //end of the function ThreadInitLock
示例10: AAS_CalcReachAndClusters
void AAS_CalcReachAndClusters( struct quakefile_s *qf ) {
float time;
Log_Print( "loading collision map...\n" );
//
if ( !qf->pakfile[0] ) {
strcpy( qf->pakfile, qf->filename );
}
//load the map
CM_LoadMap( (char *) qf, qfalse, &( *aasworld ).bspchecksum );
//get a handle to the world model
worldmodel = CM_InlineModel( 0 ); // 0 = world, 1 + are bmodels
//initialize bot import structure
AAS_InitBotImport();
//load the BSP entity string
AAS_LoadBSPFile();
//init physics settings
AAS_InitSettings();
//initialize AAS link heap
AAS_InitAASLinkHeap();
//initialize the AAS linked entities for the new map
AAS_InitAASLinkedEntities();
//reset all reachabilities and clusters
( *aasworld ).reachabilitysize = 0;
( *aasworld ).numclusters = 0;
//set all view portals as cluster portals in case we re-calculate the reachabilities and clusters (with -reach)
AAS_SetViewPortalsAsClusterPortals();
//calculate reachabilities
AAS_InitReachability();
time = 0;
while ( AAS_ContinueInitReachability( time ) ) time++;
//calculate clusters
AAS_InitClustering();
} //end of the function AAS_CalcReachAndClusters
示例11: Q1_LoadMapFromBSP
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void Q1_LoadMapFromBSP(char *filename, int offset, int length)
{
int i, modelnum;
char *model, *classname;
Log_Print("-- Q1_LoadMapFromBSP --\n");
//the loaded map type
loadedmaptype = MAPTYPE_QUAKE1;
//
qprintf("loading map from %s at %d\n", filename, offset);
//load the Half-Life BSP file
Q1_LoadBSPFile(filename, offset, length);
//
q1_numclipbrushes = 0;
//CreatePath(path);
//Q1_CreateQ2WALFiles(path);
//parse the entities from the BSP
Q1_ParseEntities();
//clear the map mins and maxs
ClearBounds(map_mins, map_maxs);
//
qprintf("creating Quake1 brushes\n");
if (lessbrushes)
{
qprintf("creating minimum number of brushes\n");
}
else
{
qprintf("placing textures correctly\n");
}
//
for (i = 0; i < num_entities; i++)
{
entities[i].firstbrush = nummapbrushes;
entities[i].numbrushes = 0;
//
classname = ValueForKey(&entities[i], "classname");
if (classname && !strcmp(classname, "worldspawn"))
{
modelnum = 0;
} //end if
else
{
//
model = ValueForKey(&entities[i], "model");
if (!model || *model != '*')
{
continue;
}
model++;
modelnum = atoi(model);
} //end else
//create map brushes for the entity
Q1_CreateMapBrushes(&entities[i], modelnum);
} //end for
//
qprintf("%5d map brushes\n", nummapbrushes);
qprintf("%5d clip brushes\n", q1_numclipbrushes);
} //end of the function Q1_LoadMapFromBSP
示例12: AAS_FlipAreaFaces
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_FlipAreaFaces(tmp_area_t *tmparea)
{
int side;
tmp_face_t *face;
plane_t *plane;
vec3_t wcenter, acenter = {0, 0, 0};
//winding_t *w;
float n;
for (n = 0, face = tmparea->tmpfaces; face; face = face->next[side])
{
if (!face->frontarea) Error("face %d has no front area\n", face->num);
//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;
plane = &mapplanes[face->planenum ^ side];
if (DotProduct(plane->normal, acenter) - plane->dist < 0)
{
Log_Print("area %d face %d flipped: front area %d, back area %d\n", tmparea->areanum, face->num,
face->frontarea ? face->frontarea->areanum : 0,
face->backarea ? face->backarea->areanum : 0);
/*
face->planenum = face->planenum ^ 1;
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
*/
} //end if
#ifdef L_DEBUG
{
float dist;
vec3_t normal;
//check if the winding plane is the same as the face plane
WindingPlane(face->winding, normal, &dist);
plane = &mapplanes[face->planenum];
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("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_FlipAreaFaces
示例13: RunThreadsOn
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void RunThreadsOn(int workcnt, qboolean showpacifier, void(*func)(int))
{
int i;
pthread_t work_threads[MAX_THREADS];
pthread_addr_t status;
pthread_attr_t attrib;
pthread_mutexattr_t mattrib;
int start, end;
Log_Print("pthread multi-threading\n");
start = I_FloatTime ();
dispatch = 0;
workcount = workcnt;
oldf = -1;
pacifier = showpacifier;
threaded = true;
if (numthreads < 1 || numthreads > MAX_THREADS) numthreads = 1;
if (pacifier)
setbuf (stdout, NULL);
if (!my_mutex)
{
my_mutex = GetMemory(sizeof(*my_mutex));
if (pthread_mutexattr_create (&mattrib) == -1)
Error ("pthread_mutex_attr_create failed");
if (pthread_mutexattr_setkind_np (&mattrib, MUTEX_FAST_NP) == -1)
Error ("pthread_mutexattr_setkind_np failed");
if (pthread_mutex_init (my_mutex, mattrib) == -1)
Error ("pthread_mutex_init failed");
}
if (pthread_attr_create (&attrib) == -1)
Error ("pthread_attr_create failed");
if (pthread_attr_setstacksize (&attrib, 0x100000) == -1)
Error ("pthread_attr_setstacksize failed");
for (i=0 ; i<numthreads ; i++)
{
if (pthread_create(&work_threads[i], attrib
, (pthread_startroutine_t)func, (pthread_addr_t)i) == -1)
Error ("pthread_create failed");
}
for (i=0 ; i<numthreads ; i++)
{
if (pthread_join (work_threads[i], &status) == -1)
Error ("pthread_join failed");
}
threaded = false;
end = I_FloatTime ();
if (pacifier)
printf (" (%i)\n", end-start);
} //end of the function RunThreadsOn
示例14: CountTriangles
/*
=============
CountTriangles
=============
*/
void CountTriangles( void ) {
int i, numTris, numPatchTris;
dsurface_t *surface;
numTris = numPatchTris = 0;
for ( i = 0; i < q3_numDrawSurfaces; i++ ) {
surface = &drawSurfaces[i];
numTris += surface->numIndexes / 3;
if ( surface->patchWidth ) {
numPatchTris += surface->patchWidth * surface->patchHeight * 2;
}
}
Log_Print( "%6d triangles\n", numTris );
Log_Print( "%6d patch tris\n", numPatchTris );
}
示例15: RunThreadsOn
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )(int) ) {
int threadid[MAX_THREADS];
HANDLE threadhandle[MAX_THREADS];
int i;
int start, end;
Log_Print( "Win32 multi-threading\n" );
start = I_FloatTime();
dispatch = 0;
workcount = workcnt;
oldf = -1;
pacifier = showpacifier;
threaded = true;
if ( numthreads == -1 ) {
ThreadSetDefault();
}
if ( numthreads < 1 || numthreads > MAX_THREADS ) {
numthreads = 1;
}
//
// run threads in parallel
//
InitializeCriticalSection( &crit );
numwaitingthreads = 0;
if ( numthreads == 1 ) { // use same thread
func( 0 );
} //end if
else
{
// printf("starting %d threads\n", numthreads);
for ( i = 0; i < numthreads; i++ )
{
threadhandle[i] = CreateThread(
NULL, // LPSECURITY_ATTRIBUTES lpsa,
0, // DWORD cbStack,
(LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr,
(LPVOID)i, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&threadid[i] );
// printf("started thread %d\n", i);
} //end for
for ( i = 0; i < numthreads; i++ )
WaitForSingleObject( threadhandle[i], INFINITE );
} //end else
DeleteCriticalSection( &crit );
threaded = false;
end = I_FloatTime();
if ( pacifier ) {
printf( " (%i)\n", end - start );
}
} //end of the function RunThreadsOn