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


C++ ValueForKey函数代码示例

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


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

示例1: QE_CheckAutoSave

void QE_CheckAutoSave( void ){
	static time_t s_start;
	time_t now;
	time( &now );

	if ( modified != 1 || !s_start ) {
		s_start = now;
		return;
	}

	if ( ( now - s_start ) > ( 60 * g_PrefsDlg.m_nAutoSave ) ) {
		if ( g_PrefsDlg.m_bAutoSave ) {
			CString strMsg;
			strMsg = g_PrefsDlg.m_bSnapShots ? "Autosaving snapshot..." : "Autosaving...";
			Sys_Printf( strMsg );
			Sys_Printf( "\n" );
			Sys_Status( strMsg,0 );

			// only snapshot if not working on a default map
			if ( g_PrefsDlg.m_bSnapShots && stricmp( currentmap, "unnamed.map" ) != 0 ) {
				Map_Snapshot();
			}
			else
			{
				Map_SaveFile( ValueForKey( g_qeglobals.d_project_entity, "autosave" ), false );
			}

			Sys_Status( "Autosaving...Saved.", 0 );
			modified = 2;
		}
		else
		{
			Sys_Printf( "Autosave skipped...\n" );
			Sys_Status( "Autosave skipped...", 0 );
		}
		s_start = now;
	}
}
开发者ID:GSIO01,项目名称:GtkRadiant,代码行数:38,代码来源:qe3.cpp

示例2: Entity_UpdateSoundEmitter

/*
====================
Entity_UpdateSoundEmitter

Deletes the soundEmitter if the entity should not emit a sound due
to it not having one, being filtered away, or the sound mode being turned off.

Creates or updates the soundEmitter if needed
====================
*/
void Entity_UpdateSoundEmitter( entity_t *ent )
{
    bool	playing = false;

    // if an entity doesn't have any brushes at all, don't do anything
    // if the brush isn't displayed (filtered or culled), don't do anything
    if ( g_pParentWnd->GetCamera()->GetSoundMode()
            && ent->brushes.onext != &ent->brushes && !FilterBrush(ent->brushes.onext) )
    {
        // check for sounds
        const char *v = ValueForKey( ent, "s_shader" );
        if ( v[0] )
        {
            refSound_t	sound;

            gameEdit->ParseSpawnArgsToRefSound( &ent->epairs, &sound );
            if ( !sound.waitfortrigger )  	// waitfortrigger will not start playing immediately
            {
                if ( !ent->soundEmitter )
                {
                    ent->soundEmitter = g_qeglobals.sw->AllocSoundEmitter();
                }
                playing = true;
                ent->soundEmitter->UpdateEmitter( ent->origin, 0, &sound.parms );
                // always play on a single channel, so updates always override
                ent->soundEmitter->StartSound( sound.shader, SCHANNEL_ONE );
            }
        }
    }

    // delete the soundEmitter if not used
    if ( !playing && ent->soundEmitter )
    {
        ent->soundEmitter->Free( true );
        ent->soundEmitter = NULL;
    }

}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:48,代码来源:EditorEntity.cpp

示例3: DispGetFaceInfo

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void DispGetFaceInfo( mapbrush_t *pBrush )
{
	int		i;
	side_t	*pSide;

	// we don't support displacement on entities at the moment!!
	if( pBrush->entitynum != 0 )
	{
		char* pszEntityName = ValueForKey( &entities[pBrush->entitynum], "classname" );
		Error( "Error: displacement found on a(n) %s entity - not supported\n", pszEntityName );
	}

	for( i = 0; i < pBrush->numsides; i++ )
	{
		pSide = &pBrush->original_sides[i];
		if( pSide->pMapDisp )
		{
			// error checking!!
			if( pSide->winding->numpoints != 4 )
				Error( "Trying to create a non-quad displacement!\n" );

			pSide->pMapDisp->face.originalface = pSide;
			pSide->pMapDisp->face.texinfo = pSide->texinfo;
			pSide->pMapDisp->face.dispinfo = -1;
			pSide->pMapDisp->face.planenum = pSide->planenum;
			pSide->pMapDisp->face.numpoints = pSide->winding->numpoints;
			pSide->pMapDisp->face.w = CopyWinding( pSide->winding );
			pSide->pMapDisp->face.contents = pBrush->contents;

			pSide->pMapDisp->face.merged = FALSE;
			pSide->pMapDisp->face.split[0] = FALSE;
			pSide->pMapDisp->face.split[1] = FALSE;

			pSide->pMapDisp->entitynum = pBrush->entitynum;
			pSide->pMapDisp->brushSideID = pSide->id;
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:40,代码来源:disp_vbsp.cpp

示例4: ComputeBoundsNoSkybox

//-----------------------------------------------------------------------------
// Compute the bounding box, excluding 3D skybox + skybox, add it to keyvalues
//-----------------------------------------------------------------------------
void ComputeBoundsNoSkybox( )
{
    // Iterate over all world leaves, skip those which are part of skybox
    Vector mins, maxs;
    ClearBounds (mins, maxs);
    AddNodeToBounds( dmodels[0].headnode, g_SkyAreas, mins, maxs );
    AddDispsToBounds( dmodels[0].headnode, g_SkyAreas, mins, maxs );

    // Add the bounds to the worldspawn data
    for (int i = 0; i < num_entities; ++i)
    {
        char* pEntity = ValueForKey(&entities[i], "classname");
        if (!strcmp(pEntity, "worldspawn"))
        {
            char	string[32];
            sprintf (string, "%i %i %i", (int)mins[0], (int)mins[1], (int)mins[2]);
            SetKeyValue (&entities[i], "world_mins", string);
            sprintf (string, "%i %i %i", (int)maxs[0], (int)maxs[1], (int)maxs[2]);
            SetKeyValue (&entities[i], "world_maxs", string);
            break;
        }
    }
}
开发者ID:Filip98,项目名称:source-sdk-2013,代码行数:26,代码来源:writebsp.cpp

示例5: HasUniqueEntityName

static qboolean HasUniqueEntityName(const entity_t * ent, const char *name)
{
	int             i;
	entity_t       *ent2;
	const char     *name2;

	for(i = 0; i < numEntities; i++)
	{
		ent2 = &entities[i];

		if(ent == ent2)
			continue;

		name2 = ValueForKey(ent2, "name");

		if(!Q_stricmp(name, name2))
		{
			return qfalse;
		}
	}

	return qtrue;
}
开发者ID:Asvarox,项目名称:Unvanquished,代码行数:23,代码来源:bspfile_abstract.c

示例6: FloatForKey

vec_t   FloatForKey( entity_t *ent, char *key ) {
	char    *k;

	k = ValueForKey( ent, key );
	return atof( k );
}
开发者ID:D4edalus,项目名称:CoD4x_Server,代码行数:6,代码来源:l_bsp_ent.c

示例7: CheckEntities

/**
 * @brief Perform an entity check
 */
void CheckEntities (void)
{
	Check_InitEntityDefs();

	for (int i = 0; i < num_entities; i++) {
		entity_t* e = &entities[i];
		const char* name = ValueForKey(e, "classname");
		const entityDef_t* ed = ED_GetEntityDef(name);
		const epair_t* kvp;
		const entityKeyDef_t* kd;

		if (!ed) { /* check that a definition exists */
			Check_Printf(VERB_CHECK, false, i, -1, "Not defined in entities.ufo: %s\n", name);
			continue;
		}

		/* check alignment of info_.+_start */
		if (Check_IsInfoStart(name) && !Check_InfoStartAligned(ed, e))
			Check_Printf(VERB_CHECK, false, i, -1, "Misaligned %s\n", name);

		if (Q_strstart(name, "func_")) /* func_* entities should have brushes */
			Check_EntityWithBrushes(e, name, i);

		/* check all keys in the entity - make sure they are OK */
		for (kvp = e->epairs; kvp; kvp = kvp->next) {
			kd = ED_GetKeyDefEntity(ed, kvp->key, 0); /* zero means ignore abstract (radiant only) keys */

			if (!kd) { /* make sure it has a definition */
				Check_Printf(VERB_CHECK, false, i, -1, "Not defined in entities.ufo: %s in %s\n", kvp->key, name);
				continue;
			}

			if (ED_CheckKey(kd, kvp->value) == ED_ERROR) { /* check values against type and range definitions in entities.ufo */
				Check_Printf(VERB_CHECK, false, i, -1, "%s\n", ED_GetLastError());
				continue;
			}

			if (Q_streq("target", kvp->key) || Q_streq("targetname", kvp->key)) {
				if (!Check_TargetExists(kvp)) {
					Check_Printf(VERB_CHECK, false, i, -1,
						"%s with %s of %s: no corresponding entity with %s with matching value\n",
						ed->classname, kvp->key, kvp->value, Q_streq("target", kvp->key) ? "targetname" : "target");
				}
			}
		}

		/* check keys in the entity definition - make sure mandatory ones are present */
		for (kd = ed->keyDefs; kd->name; kd++) {
			if (kd->flags & ED_MANDATORY) {
				const char* keyNameInEnt = ValueForKey(e, kd->name);
				if (keyNameInEnt[0] == '\0') {
					const char* defaultVal = kd->defaultVal;
					const bool hasDefault = defaultVal ? true : false;
					Check_Printf(VERB_CHECK, hasDefault, i, -1, "Mandatory key missing from entity: %s in %s", kd->name, name);
					if (defaultVal) {
						Check_Printf(VERB_CHECK, hasDefault, i, -1, ", supplying default: %s", defaultVal);
						SetKeyValue(e, kd->name, defaultVal);
					}
					Check_Printf(VERB_CHECK, hasDefault, i, -1, "\n");
				}
			}
		}
	}
}
开发者ID:Ed-von-Schleck,项目名称:ufoai,代码行数:67,代码来源:checkentities.cpp

示例8: RunBsp

void RunBsp( char* command )
{
	char    sys[2048];
	char    batpath[2048];
	char    outputpath[2048];
	char    temppath[1024];
	char    name[2048];
	char    cWork[2048];
	FILE*   hFile;
	BOOL    ret;
	PROCESS_INFORMATION ProcessInformation;
	STARTUPINFO startupinfo;
	HWND hwndPClient = NULL;
	
	g_hWnd = g_pParentWnd->GetSafeHwnd();
	SetInspectorMode( W_CONSOLE );
	g_tBegin = CTime::GetCurrentTime();
	
	
	DWORD   dwExitcode;
	ret = GetExitCodeProcess( g_hToolThread, &dwExitcode );
	if ( dwExitcode != STILL_ACTIVE )
		g_hToolThread = NULL;
		
	if ( bsp_process || g_hToolThread )
	{
		Sys_Printf( "BSP is still going...\n" );
		return;
	}
	
	outputpath[0] = '\0';
	GetTempPath( 512, temppath );
	
	CString strOutFile = temppath;
	AddSlash( strOutFile );
	strOutFile += "junk.txt";
	
	sprintf( outputpath, " >>%s\r\n", strOutFile );
	
	strcpy( name, currentmap );
	if ( region_active )
	{
		Map_SaveFile( name, false );
		StripExtension( name );
		strcat( name, ".reg" );
	}
	
	Map_SaveFile( name, region_active );
	
	// FIXME: this code just gets worse and worse
	CString strPath, strFile;
	
	char* rsh = ValueForKey( g_qeglobals.d_project_entity, "rshcmd" );
	if ( rsh == NULL )
	{
		ExtractPath_and_Filename( name, strPath, strFile );
		AddSlash( strPath );
		BuildShortPathName( strPath, cWork, 1024 );
		strcat( cWork, strFile );
	}
	else
	{
		strcpy( cWork, name );
	}
	
	hwndPClient = FindWindow( NULL, "Q3Map Process Client" );
	if ( hwndPClient == NULL )
	{
		hwndPClient = FindAnyWindow( "Q3Map Process Client" );
	}
	
	Sys_Printf( "Window info for Process Client %i\n", reinterpret_cast<int>( hwndPClient ) );
	
	bool processServer = ( rsh && strlen( rsh ) > 0 && hwndPClient );
	
	QE_ExpandBspString( command, sys, cWork, processServer );
	
	// if we can find the q3map process server running
	// we will submit maps to it instead of via createprocess
	//
	if ( processServer )
	{
		CString str;
		char cBuff[2048];
		char* pStart = sys;
		char* pEnd = strstr( pStart, "&&" );
		while ( pEnd )
		{
			int nLen = pEnd - pStart - 1;
			strncpy( cBuff, pStart, nLen );
			cBuff[nLen] = 0;
			str = cBuff;
			FindReplace( str, rsh, "" );
			str.TrimLeft( ' ' );
			str.TrimRight( ' ' );
			ATOM a = GlobalAddAtom( str );
			PostMessage( hwndPClient, wm_AddCommand, 0, ( LPARAM )a );
			pStart = pEnd + 2;
			pEnd = strstr( pStart, "&&" );
		}
//.........这里部分代码省略.........
开发者ID:OnlyTheGhosts,项目名称:OWEngine,代码行数:101,代码来源:Win_main.cpp

示例9: qprintf

/*
===========
FillOutside

===========
*/
node_t *FillOutside (node_t *node, qboolean leakfile)
{
    int			s;
    vec_t		*v;
    int			i;
    qboolean	inside;
    qboolean	ret;
    vec3_t		origin;
    char		*cl;

    qprintf ("----- FillOutside ----\n");

    if (nofill)
    {
        printf ("skipped\n");
        return node;
    }

    //
    // place markers for all entities so
    // we know if we leak inside
    //
    inside = false;
    for (i=1 ; i<num_entities ; i++)
    {
        GetVectorForKey (&entities[i], "origin", origin);
        if (!VectorCompare(origin, vec3_origin))
        {
            cl = ValueForKey (&entities[i], "classname");
            origin[2] += 1;	// so objects on floor are ok

            // nudge playerstart around if needed so clipping hulls allways
            // have a vlaid point
            if (!strcmp (cl, "info_player_start"))
            {
                int	x, y;

                for (x=-16 ; x<=16 ; x += 16)
                {
                    for (y=-16 ; y<=16 ; y += 16)
                    {
                        origin[0] += x;
                        origin[1] += y;
                        if (PlaceOccupant (i, origin, node))
                        {
                            inside = true;
                            goto gotit;
                        }
                        origin[0] -= x;
                        origin[1] -= y;
                    }
                }
gotit:
                ;
            }
            else
            {
                if (PlaceOccupant (i, origin, node))
                    inside = true;
            }
        }
    }

    if (!inside)
    {
        printf ("Hullnum %i: No entities in empty space -- no filling performed\n", hullnum);
        return node;
    }

    s = !(outside_node.portals->nodes[1] == &outside_node);

// first check to see if an occupied leaf is hit
    outleafs = 0;
    valid++;

    prevleaknode = NULL;

    if (leakfile)
    {
        pointfile = fopen (pointfilename, "w");
        if (!pointfile)
            Error ("Couldn't open %s\n", pointfilename);
        StripExtension (pointfilename);
        strcat (pointfilename, ".lin");
        linefile = fopen (pointfilename, "w");
        if (!linefile)
            Error ("Couldn't open %s\n", pointfilename);
    }

    ret = RecursiveFillOutside (outside_node.portals->nodes[s], false);

    if (leakfile)
    {
        fclose (pointfile);
//.........这里部分代码省略.........
开发者ID:LAxBANDA,项目名称:cs16nd,代码行数:101,代码来源:outside.c

示例10: EditCommandDlgProc

BOOL CALLBACK EditCommandDlgProc (
    HWND hwndDlg,	// handle to dialog box
    UINT uMsg,	// message
    WPARAM wParam,	// first message parameter
    LPARAM lParam 	// second message parameter
   )
{
	char	key[1024];
	char	value[1024];
	const char	*temp;
	int		index;
	HWND	hOwner;
	
	hOwner = GetParent (hwndDlg);

	switch (uMsg)
    {
	case WM_INITDIALOG:
		index = SendDlgItemMessage (hOwner, IDC_CMD_LIST, LB_GETCURSEL, 0, 0);
    if (index >= 0)
    {
		  SendDlgItemMessage(hOwner, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key);
		  temp = ValueForKey (g_qeglobals.d_project_entity, key);
		  strcpy (value, temp);
		  SetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key);
		  SetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value);
    }
		return FALSE;
		break;

	case WM_COMMAND: 
		switch (LOWORD(wParam)) 
		{ 
			case IDOK:
				if (!GetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key, 64))
				{
					common->Printf ("Command not added\n");
					return FALSE;
				}

				if (!GetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value, 64))
				{
					common->Printf ("Command not added\n");
					return FALSE;
				}

				//if (key[0] == 'b' && key[1] == 's' && key[2] == 'p')
				//{
					SetKeyValue (g_qeglobals.d_project_entity, key, value);
					FillBSPMenu ();
				//}
				//else
				//	common->Printf ("BSP commands must be preceded by \"bsp\"");

				EndDialog(hwndDlg, 1);
				return TRUE;

			case IDCANCEL:
				EndDialog(hwndDlg, 0);
				return TRUE;
		}
	}
	return FALSE;
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:64,代码来源:WIN_DLG.CPP

示例11: Parse_Serverinfo


//.........这里部分代码省略.........
            slen = strlen(name);
            s->spectatorsn++;
            ping = -ping;

            if (name[0] == '\\' && name[1] == 's' && name[2] == '\\')
                nameptr = name+3; // strip \s\<name>
            else if (slen > 3 && name[slen-3] == '(' && name[slen-2] == 's' && name[slen-1] == ')')
                name[slen-3] = 0; // strip <name>(s) for old servers
        }

        s->players[i] = (playerinfo *)Q_malloc(sizeof(playerinfo));
        s->players[i]->id = id;
        s->players[i]->frags = frags;
        s->players[i]->time = time;
        s->players[i]->ping = ping;
        s->players[i]->spec = spec;

        s->players[i]->top = Sbar_ColorForMap(top);
        s->players[i]->bottom = Sbar_ColorForMap(bottom);

        strlcpy(s->players[i]->name, nameptr, sizeof(s->players[0]->name));
        strlcpy(s->players[i]->skin, skin, sizeof(s->players[0]->skin));
        strlcpy(s->players[i]->team, team, sizeof(s->players[0]->team));

        pinfo = strchr(pinfo, '\n') + 1;
    }

    {
    void *swap;
    int n;
    // sort players by frags
    n = s->playersn + s->spectatorsn - 2;
    for (i = 0; i <= n; i++)
        for (j = n; j >= i; j--)
            if (s->players[j] && s->players[j+1] && s->players[j]->frags < s->players[j+1]->frags)
            {
                swap = (void*)s->players[j];
                s->players[j] = s->players[j+1];
                s->players[j+1] = (playerinfo*)swap;
            }
    // sort keys
    n = s->keysn - 2;
    for (i = 0; i <= n; i++)
        for (j = n; j >= i; j--)
            if (strcasecmp(s->keys[j], s->keys[j+1]) > 0)
            {
                swap = (void*)s->keys[j];
                s->keys[j] = s->keys[j+1];
                s->keys[j+1] = (char*)swap;
                swap = (void*)s->values[j];
                s->values[j] = s->values[j+1];
                s->values[j+1] = (char*)swap;
            }
    }

    // fill-in display
	s->qwfwd = SB_IsServerQWfwd(s);

    tmp = ValueForKey(s, "hostname");
    if (tmp != NULL)
        snprintf (s->display.name, sizeof (s->display.name),"%-.*s", COL_NAME, tmp);
    else
        return;

    tmp = ValueForKey(s, "fraglimit");
    if (tmp != NULL)
        snprintf(s->display.fraglimit, sizeof (s->display.fraglimit), "%*.*s", COL_FRAGLIMIT, COL_FRAGLIMIT, strlen(tmp) > COL_FRAGLIMIT ? "999" : tmp);

    tmp = ValueForKey(s, "timelimit");
    if (tmp != NULL)
        snprintf(s->display.timelimit, sizeof (s->display.timelimit), "%*.*s", COL_TIMELIMIT, COL_TIMELIMIT, strlen(tmp) > COL_TIMELIMIT ? "99" : tmp);

    tmp = ValueForKey(s, "*gamedir");
    s->qizmo = false;
    if (tmp != NULL)
        snprintf(s->display.gamedir, sizeof (s->display.gamedir) ,"%.*s", COL_GAMEDIR, tmp==NULL ? "" : tmp);
    else
    {
        tmp = ValueForKey(s, "*progs");
        if (tmp != NULL  &&  !strcmp(tmp, "666"))
        {
            snprintf(s->display.gamedir, sizeof (s->display.gamedir), "qizmo");
            s->qizmo = true;
        }
    }

    tmp = ValueForKey(s, "map");
    if (tmp != NULL)
        snprintf(s->display.map, sizeof (s->display.map), "%-.*s", COL_MAP, tmp==NULL ? "" : tmp);

    tmp = ValueForKey(s, "maxclients");
    if (!tmp || strlen(tmp) > 2)
        tmp = "99";
    i = s->playersn > 99 ? 99 : s->playersn;
    if (i < 1) { s->occupancy = SERVER_EMPTY; }
    else if (i > 0 && i < atoi(tmp)) { s->occupancy = SERVER_NONEMPTY; }
    else { s->occupancy = SERVER_FULL; }
    if (tmp != NULL)
        snprintf(s->display.players, sizeof (s->display.players), "%2d/%-2s", i, tmp==NULL ? "" : tmp);
}
开发者ID:Classic-Fortress,项目名称:client,代码行数:101,代码来源:EX_browser_net.c

示例12: GetParamsFromEnt

// AJM: addded in
// =====================================================================================
//  GetParamsFromEnt
//      this function is called from parseentity when it encounters the 
//      info_compile_parameters entity. each tool should have its own version of this
//      to handle its own specific settings.
// =====================================================================================
void            GetParamsFromEnt(entity_t* mapent)
{
    int iTmp;

    Log("\nCompile Settings detected from info_compile_parameters entity\n");

    // verbose(choices) : "Verbose compile messages" : 0 = [ 0 : "Off" 1 : "On" ]
    iTmp = IntForKey(mapent, "verbose");
    if (iTmp == 1)
    {
        g_verbose = true;
    }
    else if (iTmp == 0)
    {
        g_verbose = false;
    }
    Log("%30s [ %-9s ]\n", "Compile Option", "setting");
    Log("%30s [ %-9s ]\n", "Verbose Compile Messages", g_verbose ? "on" : "off");

    // estimate(choices) :"Estimate Compile Times?" : 0 = [ 0: "Yes" 1: "No" ]
    if (IntForKey(mapent, "estimate")) 
    {
        g_estimate = true;
    }
    else
    {
        g_estimate = false;
    }
    Log("%30s [ %-9s ]\n", "Estimate Compile Times", g_estimate ? "on" : "off");

	// priority(choices) : "Priority Level" : 0 = [	0 : "Normal" 1 : "High"	-1 : "Low" ]
	if (!strcmp(ValueForKey(mapent, "priority"), "1"))
    {
        g_threadpriority = eThreadPriorityHigh;
        Log("%30s [ %-9s ]\n", "Thread Priority", "high");
    }
    else if (!strcmp(ValueForKey(mapent, "priority"), "-1"))
    {
        g_threadpriority = eThreadPriorityLow;
        Log("%30s [ %-9s ]\n", "Thread Priority", "low");
    }

    /*
    hlvis(choices) : "HLVIS" : 2 = 
    [ 
        0 : "Off"
        1 : "Fast"
        2 : "Normal" 
        3 : "Full"
    ]
    */
    iTmp = IntForKey(mapent, "hlvis");
    if (iTmp == 0)
    {
        Fatal(assume_TOOL_CANCEL, 
            "%s flag was not checked in info_compile_parameters entity, execution of %s cancelled", g_Program, g_Program);
        CheckFatal();   
    }
    else if (iTmp == 1)
    {
        g_fastvis = true;
        g_fullvis = false;
    }
    else if (iTmp == 2)
    {
        g_fastvis = false;
        g_fullvis = false;
    }
    else if (iTmp == 3)
    {
        g_fullvis = true;
        g_fastvis = false;
    }
    Log("%30s [ %-9s ]\n", "Fast VIS", g_fastvis ? "on" : "off"); 
    Log("%30s [ %-9s ]\n", "Full VIS", g_fullvis ? "on" : "off" );

    ///////////////////
    Log("\n");
}
开发者ID:sbenfold,项目名称:zhlt-linux,代码行数:86,代码来源:vis.cpp

示例13: WriteMiptex

void WriteMiptex (void)
{
	int i, success;
	byte *miptex_data;
	dmiptexlump_t *miptex_lumps;
	char *path, *currentpath;
	miptexfile_t *m;

	path = ValueForKey (&entities[0], "_wad");
	if (!path || !path[0])
	{
		path = ValueForKey (&entities[0], "wad");
		if (!path || !path[0])
		{
			printf ("WriteMiptex: no wads specified in \"wad\" key in worldspawn\n");
			texdatasize = 0;
			return;
		}
	}

	nummiptexfiles = 0;

	currentpath = path;
	while (*currentpath)
	{
		getwadname(wadname, &currentpath);
		if (wadname[0])
		{
			success = false;
			// try prepending each -wadpath on the commandline to the wad name
			for (i = 1;i < myargc;i++)
			{
				if (!Q_strcasecmp("-wadpath", myargv[i]))
				{
					i++;
					if (i < myargc)
					{
						sprintf(wadfilename, "%s%s", myargv[i], wadname);
						if ((success = loadwad(wadfilename) >= 0))
							break;
					}
				}
			}
			if (!success)
			{
				// if the map name has a path, we can try loading the wad from there
				ExtractFilePath(bspfilename, wadfilename);
				if (wadfilename[0])
				{
					strcat(wadfilename, wadname);
					if (!(success = loadwad(wadfilename) >= 0))
					{
						// try the parent directory
						ExtractFilePath(bspfilename, wadfilename);
						strcat(wadfilename, "../");
						strcat(wadfilename, wadname);
						success = loadwad(wadfilename) >= 0;
					}
				}
			}
			if (!success)
			{
				// try the wadname itself
				success = loadwad(wadname) >= 0;
			}
			if (!success)
				printf("Could not find wad \"%s\" using -wadpath options or in the same directory as the map or it's parent directory, so there!\n", wadname);
		}
	}

	for (i = 0;i < nummiptex;i++)
		CleanupName(miptex[i], miptex[i]);

	AddAnimatingTextures();

	miptex_lumps = (dmiptexlump_t *)dtexdata;
	miptex_data = (byte *)&miptex_lumps->dataofs[nummiptex];
	miptex_lumps->nummiptex = nummiptex;
	for (i=0 ; i < nummiptex ; i++)
	{
		printf("miptex used: %s", miptex[i]);
		m = FindMipTexFile(miptex[i]);
		if (m)
		{
			if (miptex_data + m->size - dtexdata >= MAX_MAP_MIPTEX)
			{
				miptex_lumps->dataofs[i] = -1;
				printf(" (MAX_MAP_MIPTEX exceeded)\n");
			}
			else if (ReadMipTexFile(m, miptex_data))
			{
				miptex_lumps->dataofs[i] = -1;
				printf(" (READ ERROR)\n");
			}
			else
			{
				miptex_lumps->dataofs[i] = miptex_data - (byte *)miptex_lumps;
				printf("\n");
				miptex_data += m->size;
			}
//.........这里部分代码省略.........
开发者ID:AidHamza,项目名称:eviltoys,代码行数:101,代码来源:wad.c

示例14: FloodEntities

//===========================================================================
// Marks all nodes that can be reached by entites
//
// Parameter:               -
// Returns:                 -
// Changes Globals:     -
//===========================================================================
qboolean FloodEntities(tree_t *tree)
{
	int i;
	int x, y;
	vec3_t origin;
	char *cl;
	qboolean inside;
	node_t *headnode;

	headnode = tree->headnode;
	Log_Print("------ FloodEntities -------\n");
	inside = false;
	tree->outside_node.occupied = 0;

	//start at entity 1 not the world ( = 0)
	for(i = 1; i < num_entities; i++)
	{
		GetVectorForKey(&entities[i], "origin", origin);

		if(VectorCompare(origin, vec3_origin))
		{
			continue;
		}

		cl = ValueForKey(&entities[i], "classname");
		origin[2] += 1; //so objects on floor are ok

//		Log_Print("flooding from entity %d: %s\n", i, cl);
		//nudge playerstart around if needed so clipping hulls allways
		//have a valid point
		if(!strcmp(cl, "info_player_start"))
		{
			for(x = -16; x <= 16; x += 16)
			{
				for(y = -16; y <= 16; y += 16)
				{
					origin[0] += x;
					origin[1] += y;

					if(PlaceOccupant(headnode, origin, &entities[i]))
					{
						inside = true;
						x = 999; //stop for this info_player_start
						break;
					} //end if

					origin[0] -= x;
					origin[1] -= y;
				} //end for
			} //end for
		} //end if
		else
		{
			if(PlaceOccupant(headnode, origin, &entities[i]))
			{
				inside = true;
			} //end if
		} //end else
	} //end for

	if(!inside)
	{
		Log_Print("WARNING: no entities inside\n");
	} //end if
	else if(tree->outside_node.occupied)
	{
		Log_Print("WARNING: entity reached from outside\n");
	} //end else if

	return (qboolean)(inside && !tree->outside_node.occupied);
} //end of the function FloodEntities
开发者ID:Diskutant,项目名称:RTCW-SP,代码行数:78,代码来源:portals.c

示例15: ParseMapEntity

/*
================
ParseMapEntity
================
*/
qboolean	ParseMapEntity (void)
{
	entity_t	*mapent;
	epair_t		*e;
	side_t		*s;
	int			i, j;
	int			startbrush, startsides;
	vec_t		newdist;
	mapbrush_t	*b;

	if (!GetToken (true))
		return false;

	if (strcmp (token, "{") )
		Error ("ParseEntity: { not found");
	
	if (num_entities == MAX_MAP_ENTITIES)
		Error ("num_entities == MAX_MAP_ENTITIES");

	startbrush = nummapbrushes;
	startsides = nummapbrushsides;

	mapent = &entities[num_entities];
	num_entities++;
	memset (mapent, 0, sizeof(*mapent));
	mapent->firstbrush = nummapbrushes;
	mapent->numbrushes = 0;
//	mapent->portalareas[0] = -1;
//	mapent->portalareas[1] = -1;

	do
	{
		if (!GetToken (true))
			Error ("ParseEntity: EOF without closing brace");
		if (!strcmp (token, "}") )
			break;
		if (!strcmp (token, "{") )
			ParseBrush (mapent);
		else
		{
			e = ParseEpair ();
			e->next = mapent->epairs;
			mapent->epairs = e;
		}
	} while (1);

	GetVectorForKey (mapent, "origin", mapent->origin);

	//
	// if there was an origin brush, offset all of the planes and texinfo
	//
	if (mapent->origin[0] || mapent->origin[1] || mapent->origin[2])
	{
		for (i=0 ; i<mapent->numbrushes ; i++)
		{
			b = &mapbrushes[mapent->firstbrush + i];
			for (j=0 ; j<b->numsides ; j++)
			{
				s = &b->original_sides[j];
				newdist = mapplanes[s->planenum].dist -
					DotProduct (mapplanes[s->planenum].normal, mapent->origin);
				s->planenum = FindFloatPlane (mapplanes[s->planenum].normal, newdist);
				s->texinfo = TexinfoForBrushTexture (&mapplanes[s->planenum],
					&side_brushtextures[s-brushsides], mapent->origin);
			}
			MakeBrushWindings (b);
		}
	}

	// group entities are just for editor convenience
	// toss all brushes into the world entity
	if (!strcmp ("func_group", ValueForKey (mapent, "classname")))
	{
		MoveBrushesToWorld (mapent);
		mapent->numbrushes = 0;
		return true;
	}

	// areaportal entities move their brushes, but don't eliminate
	// the entity
	if (!strcmp ("func_areaportal", ValueForKey (mapent, "classname")))
	{
		char	str[128];

		if (mapent->numbrushes != 1)
			Error ("Entity %i: func_areaportal can only be a single brush", num_entities-1);

		b = &mapbrushes[nummapbrushes-1];
		b->contents = CONTENTS_AREAPORTAL;
		c_areaportals++;
		mapent->areaportalnum = c_areaportals;
		// set the portal number as "style"
		sprintf (str, "%i", c_areaportals);
		SetKeyValue (mapent, "style", str);
		MoveBrushesToWorld (mapent);
//.........这里部分代码省略.........
开发者ID:TTimo,项目名称:GtkRadiant,代码行数:101,代码来源:map.c


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