当前位置: 首页>>代码示例>>C++>>正文


C++ Con_Error函数代码示例

本文整理汇总了C++中Con_Error函数的典型用法代码示例。如果您正苦于以下问题:C++ Con_Error函数的具体用法?C++ Con_Error怎么用?C++ Con_Error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Con_Error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CBuffer_New

CBuffer* CBuffer_New(uint maxNumLines, uint maxLineLength, int flags)
{
    char name[32+1];
    CBuffer* cb;

    if(maxNumLines < 1 || maxLineLength < 1)
        Con_Error("CBuffer::New: Odd buffer params");

    cb = (CBuffer*)malloc(sizeof *cb);
    if(!cb) Con_Error("CBuffer::New: Failed on allocation of %lu bytes for new CBuffer.", (unsigned long) sizeof *cb);

    dd_snprintf(name, 33, "CBufferMutex%p", cb);
    cb->mutex = Sys_CreateMutex(name);

    cb->flags = flags;
    cb->head = cb->tail = NULL;
    cb->used = NULL;

    cb->numLines = 0;
    cb->maxLineLen = maxLineLength;
    cb->writebuf = (char*)calloc(1, cb->maxLineLen+1);
    if(!cb->writebuf) Con_Error("CBuffer::New: Failed on allocation of %lu bytes for write buffer.", (unsigned long) (cb->maxLineLen+1));
    cb->wbc = 0;
    cb->wbFlags = 0;
    cb->maxLines = maxNumLines;

    // Allocate the index now.
    cb->index = (cbnode_t**)malloc(cb->maxLines * sizeof *cb->index);
    if(!cb->index) Con_Error("CBuffer::New: Failed on allocation of %lu bytes for line index.", (unsigned long) (cb->maxLines * sizeof *cb->index));
    cb->indexSize = cb->maxLines;
    cb->indexGood = true; // its empty so...

    return cb;
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:34,代码来源:cbuffer.cpp

示例2: DG_Begin

//===========================================================================
// DG_Begin
//===========================================================================
void DG_Begin(int mode)
{
	if(mode == DGL_SEQUENCE)
	{
		if(inSequence) return;
		inSequence = true;
		if(FAILED(hr = dev->BeginScene()))
		{
#ifdef _DEBUG
			DXError("BeginScene");
			Con_Error("BeginScene Failed\n");
#endif
		}
		return;
	}

	// Begin the scene automatically.
	if(!inSequence) 
	{
		if(FAILED(dev->BeginScene()))
		{
#ifdef _DEBUG
			DXError("BeginScene");
			Con_Error("BeginScene Failed\n");
#endif
		}
	}

	primType = mode;
	indexPos = 0;
	primOrder = 0;
	/*primCount = 0;*/
	vertexPos = 0;
}
开发者ID:amitahire,项目名称:development,代码行数:37,代码来源:draw.cpp

示例3: EmitMarkFace

void EmitMarkFace (dleaf_t *leaf_p, face_t *f)
{
	int			i;
	int			facenum;

	while (f->merged)
		f = f->merged;

	if (f->split[0])
	{
		EmitMarkFace (leaf_p, f->split[0]);
		EmitMarkFace (leaf_p, f->split[1]);
		return;
	}

	facenum = f->outputnumber;
	if (facenum == -1)
		return;	// degenerate face

	if (facenum < 0 || facenum >= numfaces)
		Con_Error("Bad leafface\n");
	for (i=leaf_p->firstleafface ; i<numleaffaces ; i++)
		if (dleaffaces[i] == facenum)
			break;		// merged out face
	if (i == numleaffaces)
	{
		if (numleaffaces >= MAX_MAP_LEAFFACES)
			Con_Error("MAX_MAP_LEAFFACES\n");

		dleaffaces[numleaffaces] =  facenum;
		numleaffaces++;
	}
}
开发者ID:raynorpat,项目名称:cake,代码行数:33,代码来源:writebsp.c

示例4: W_OpenAuxiliary

void W_OpenAuxiliary(char *filename)
{
	int     i;
	int     size;
	wadinfo_t header;
	int     handle;
	int     length;
	filelump_t *fileinfo;
	filelump_t *sourceLump;
	lumpinfo_t *destLump;

	if(AuxiliaryOpened)
	{
		W_CloseAuxiliary();
	}
	if((handle = open(filename, O_RDONLY | O_BINARY)) == -1)
	{
		Con_Error("W_OpenAuxiliary: %s not found.", filename);
		return;
	}
	AuxiliaryHandle = handle;
	read(handle, &header, sizeof(header));
	if(strncmp(header.identification, "IWAD", 4))
	{
		if(strncmp(header.identification, "PWAD", 4))
		{						// Bad file id
			Con_Error("Wad file %s doesn't have IWAD or PWAD id\n", filename);
		}
	}
	header.numlumps = LONG(header.numlumps);
	header.infotableofs = LONG(header.infotableofs);
	length = header.numlumps * sizeof(filelump_t);
	fileinfo = Z_Malloc(length, PU_STATIC, 0);
	lseek(handle, header.infotableofs, SEEK_SET);
	read(handle, fileinfo, length);
	numlumps = header.numlumps;

	// Init the auxiliary lumpinfo array
	lumpinfo = Z_Malloc(numlumps * sizeof(lumpinfo_t), PU_STATIC, 0);
	sourceLump = fileinfo;
	destLump = lumpinfo;
	for(i = 0; i < numlumps; i++, destLump++, sourceLump++)
	{
		destLump->handle = handle;
		destLump->position = LONG(sourceLump->filepos);
		destLump->size = LONG(sourceLump->size);
		strncpy(destLump->name, sourceLump->name, 8);
	}
	Z_Free(fileinfo);

	// Allocate the auxiliary lumpcache array
	size = numlumps * sizeof(*lumpcache);
	lumpcache = Z_Malloc(size, PU_STATIC, 0);
	memset(lumpcache, 0, size);

	AuxiliaryLumpInfo = lumpinfo;
	AuxiliaryLumpCache = lumpcache;
	AuxiliaryNumLumps = numlumps;
	AuxiliaryOpened = true;
}
开发者ID:amitahire,项目名称:development,代码行数:60,代码来源:dd_wad.c

示例5: Sys_ConInit

void Sys_ConInit()
{
	char    title[256];

	FreeConsole();
	if(!AllocConsole())
	{
		Con_Error("couldn't allocate a console! error %i\n", GetLastError());
	}
	hcInput = GetStdHandle(STD_INPUT_HANDLE);
	if(hcInput == INVALID_HANDLE_VALUE)
		Con_Error("bad input handle\n");

	// Compose the title.
	sprintf(title, "Doomsday " DOOMSDAY_VERSION_TEXT " (Dedicated) : %s",
			gx.Get(DD_GAME_ID));

	if(!SetConsoleTitle(title))
		Con_Error("setting console title: error %i\n", GetLastError());

	hcScreen = GetStdHandle(STD_OUTPUT_HANDLE);
	if(hcScreen == INVALID_HANDLE_VALUE)
		Con_Error("bad output handle\n");

	GetConsoleScreenBufferInfo(hcScreen, &cbInfo);

	// This is the location of the print cursor.
	cx = 0;
	cy = cbInfo.dwSize.Y - 2;
	Sys_ConUpdateCmdLine("");
}
开发者ID:amitahire,项目名称:development,代码行数:31,代码来源:sys_console.c

示例6: G_AddEventSequence

void G_AddEventSequence(const char* sequence, eventsequencehandler_t callback)
{
    if(!inited) Con_Error("G_AddEventSequence: Subsystem not presently initialized.");
    if(!sequence || !sequence[0] || !callback) Con_Error("G_AddEventSequence: Invalid argument(s).");

    SequenceCompleteHandler* handler = new SequenceCompleteHandler(callback);
    sequences.push_back(new EventSequence(sequence, *handler));
}
开发者ID:gnuzinho,项目名称:Doomsday-Engine,代码行数:8,代码来源:g_eventsequence.cpp

示例7: G_AddEventSequenceCommand

void G_AddEventSequenceCommand(const char* sequence, const char* commandTemplate)
{
    if(!inited) Con_Error("G_AddEventSequenceCommand: Subsystem not presently initialized.");
    if(!sequence || !sequence[0] || !commandTemplate || !commandTemplate[0]) Con_Error("G_AddEventSequenceCommand: Invalid argument(s).");

    SequenceCompleteCommandHandler* handler = new SequenceCompleteCommandHandler(commandTemplate);
    sequences.push_back(new EventSequence(sequence, *handler));
}
开发者ID:gnuzinho,项目名称:Doomsday-Engine,代码行数:8,代码来源:g_eventsequence.cpp

示例8: PHS

/*
================
CalcPHS

Calculate the PHS (Potentially Hearable Set)
by ORing together all the PVS visible from a leaf
================
*/
void CalcPHS (void)
{
	int		i, j, k, l, index;
	int		bitbyte;
	long	*dest, *src;
	byte	*scan;
	int		count;
	byte	uncompressed[MAX_MAP_LEAFS/8];
	byte	compressed[MAX_MAP_LEAFS/8];

	Con_Print("Building PHS...\n");

	count = 0;
	for (i=0 ; i<portalclusters ; i++)
	{
		scan = uncompressedvis + i*leafbytes;
		memcpy (uncompressed, scan, leafbytes);
		for (j=0 ; j<leafbytes ; j++)
		{
			bitbyte = scan[j];
			if (!bitbyte)
				continue;
			for (k=0 ; k<8 ; k++)
			{
				if (! (bitbyte & (1<<k)) )
					continue;
				// OR this pvs row into the phs
				index = ((j<<3)+k);
				if (index >= portalclusters)
					Con_Error("Bad bit in PVS\n");	// pad bits should be 0
				src = (long *)(uncompressedvis + index*leafbytes);
				dest = (long *)uncompressed;
				for (l=0 ; l<leaflongs ; l++)
					((long *)uncompressed)[l] |= src[l];
			}
		}
		for (j=0 ; j<portalclusters ; j++)
			if (uncompressed[j>>3] & (1<<(j&7)) )
				count++;

	//
	// compress the bit string
	//
		j = CompressVis (uncompressed, compressed);

		dest = (long *)vismap_p;
		vismap_p += j;
		
		if (vismap_p > vismap_end)
			Con_Error("Vismap expansion overflow\n");

		dvis->bitofs[i][DVIS_PHS] = (byte *)dest-vismap;

		memcpy (dest, compressed, j);	
	}

	Con_Print("Average clusters hearable: %i\n", count/portalclusters);
}
开发者ID:raynorpat,项目名称:cake,代码行数:66,代码来源:qvis.c

示例9: ClusterMerge

/*
===============
ClusterMerge

Merges the portal visibility for a leaf
===============
*/
void ClusterMerge (int leafnum)
{
	leaf_t		*leaf;
	byte		portalvector[MAX_PORTALS/8];
	byte		uncompressed[MAX_MAP_LEAFS/8];
	byte		compressed[MAX_MAP_LEAFS/8];
	int			i, j;
	int			numvis;
	byte		*dest;
	portal_t	*p;
	int			pnum;

	// OR together all the portalvis bits

	memset (portalvector, 0, portalbytes);
	leaf = &leafs[leafnum];
	for (i=0 ; i<leaf->numportals ; i++)
	{
		p = leaf->portals[i];
		if (p->status != stat_done)
			Con_Error("portal not done\n");
		for (j=0 ; j<portallongs ; j++)
			((long *)portalvector)[j] |= ((long *)p->portalvis)[j];
		pnum = p - portals;
		portalvector[pnum>>3] |= 1<<(pnum&7);
	}

	// convert portal bits to leaf bits
	numvis = LeafVectorFromPortalVector (portalvector, uncompressed);

	if (uncompressed[leafnum>>3] & (1<<(leafnum&7)))
		Con_Print("WARNING: Leaf portals saw into leaf\n");
		
	uncompressed[leafnum>>3] |= (1<<(leafnum&7));
	numvis++;		// count the leaf itself

	// save uncompressed for PHS calculation
	memcpy (uncompressedvis + leafnum*leafbytes, uncompressed, leafbytes);

//
// compress the bit string
//
	Con_Verbose ("cluster %4i : %4i visible\n", leafnum, numvis);
	totalvis += numvis;

	i = CompressVis (uncompressed, compressed);

	dest = vismap_p;
	vismap_p += i;
	
	if (vismap_p > vismap_end)
		Con_Error("Vismap expansion overflow\n");

	dvis->bitofs[leafnum][DVIS_PVS] = dest-vismap;

	memcpy (dest, compressed, i);	
}
开发者ID:raynorpat,项目名称:cake,代码行数:64,代码来源:qvis.c

示例10: FI_ScriptSuspended

boolean FI_ScriptSuspended(finaleid_t id)
{
    finale_t* f;
    if(!inited)
        Con_Error("FI_ScriptSuspended: Not initialized yet!");
    f = finalesById(id);
    if(!f)
        Con_Error("FI_ScriptSuspended: Unknown finaleid %u.", id);
    return FinaleInterpreter_IsSuspended(f->_interpreter);
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:10,代码来源:fi_main.cpp

示例11: FI_ScriptFlags

int FI_ScriptFlags(finaleid_t id)
{
    finale_t* f;
    if(!inited)
        Con_Error("FI_ScriptFlags: Not initialized yet!");
    f = finalesById(id);
    if(!f)
        Con_Error("FI_ScriptFlags: Unknown finaleid %u.", id);
    return f->flags;
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:10,代码来源:fi_main.cpp

示例12: EmitDrawNode_r

/*
============
EmitDrawingNode_r
============
*/
int EmitDrawNode_r (node_t *node)
{
	dnode_t	*n;
	face_t	*f;
	int		i;

	if (node->planenum == PLANENUM_LEAF)
	{
		EmitLeaf (node);
		return -numleafs;
	}

	// emit a node	
	if (numnodes == MAX_MAP_NODES)
		Con_Error("MAX_MAP_NODES\n");
	n = &dnodes[numnodes];
	numnodes++;

	VectorCopy (node->mins, n->mins);
	VectorCopy (node->maxs, n->maxs);

	if (node->planenum & 1)
		Con_Error("WriteDrawNodes_r: odd planenum\n");
	n->planenum = node->planenum;
	n->firstface = numfaces;

	if (!node->faces)
		c_nofaces++;
	else
		c_facenodes++;

	for (f=node->faces ; f ; f=f->next)
		EmitFace (f);

	n->numfaces = numfaces - n->firstface;

	//
	// recursively output the other nodes
	//	
	for (i=0 ; i<2 ; i++)
	{
		if (node->children[i]->planenum == PLANENUM_LEAF)
		{
			n->children[i] = -(numleafs + 1);
			EmitLeaf (node->children[i]);
		}
		else
		{
			n->children[i] = numnodes;	
			EmitDrawNode_r (node->children[i]);
		}
	}

	return n - dnodes;
}
开发者ID:raynorpat,项目名称:cake,代码行数:60,代码来源:writebsp.c

示例13: FI_ScriptSuspend

void FI_ScriptSuspend(finaleid_t id)
{
    finale_t* f;
    if(!inited)
        Con_Error("FI_ScriptSuspend: Not initialized yet!");
    f = finalesById(id);
    if(!f)
        Con_Error("FI_ScriptSuspend: Unknown finaleid %u.", id);
    f->active = false;
    FinaleInterpreter_Suspend(f->_interpreter);
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:11,代码来源:fi_main.cpp

示例14: FI_ScriptResume

void FI_ScriptResume(finaleid_t id)
{
    finale_t* f;
    if(!inited)
        Con_Error("FI_ScriptResume: Not initialized yet!");
    f = finalesById(id);
    if(!f)
        Con_Error("FI_ScriptResume: Unknown finaleid %u.", id);
    f->active = true;
    FinaleInterpreter_Resume(f->_interpreter);
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:11,代码来源:fi_main.cpp

示例15: FI_ScriptIsMenuTrigger

boolean FI_ScriptIsMenuTrigger(finaleid_t id)
{
    finale_t* f;
    if(!inited)
        Con_Error("FI_ScriptIsMenuTrigger: Not initialized yet!");
    f = finalesById(id);
    if(!f)
        Con_Error("FI_ScriptIsMenuTrigger: Unknown finaleid %u.", id);
    if(f->active)
    {
        DEBUG_Message(("IsMenuTrigger: %i\n", FinaleInterpreter_IsMenuTrigger(f->_interpreter)));
        return FinaleInterpreter_IsMenuTrigger(f->_interpreter);
    }
    return false;
}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:15,代码来源:fi_main.cpp


注:本文中的Con_Error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。