您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CG_ConfigString函数代码示例

51自学网 2021-06-01 20:00:00
  C++
这篇教程C++ CG_ConfigString函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CG_RegisterSounds

//.........这里部分代码省略.........		cgs.media.enemyTookTheFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_enemy_1flag.wav", qtrue );	}	cgs.media.tracerSound = trap_S_RegisterSound( "sound/weapons/machinegun/buletby1.wav", qfalse );	cgs.media.selectSound = trap_S_RegisterSound( "sound/weapons/change.wav", qfalse );	cgs.media.wearOffSound = trap_S_RegisterSound( "sound/items/wearoff.wav", qfalse );	cgs.media.useNothingSound = trap_S_RegisterSound( "sound/items/use_nothing.wav", qfalse );	cgs.media.gibSound = trap_S_RegisterSound( "sound/player/gibsplt1.wav", qfalse );	cgs.media.gibBounce1Sound = trap_S_RegisterSound( "sound/player/gibimp1.wav", qfalse );	cgs.media.gibBounce2Sound = trap_S_RegisterSound( "sound/player/gibimp2.wav", qfalse );	cgs.media.gibBounce3Sound = trap_S_RegisterSound( "sound/player/gibimp3.wav", qfalse );	cgs.media.teleInSound = trap_S_RegisterSound( "sound/world/telein.wav", qfalse );	cgs.media.teleOutSound = trap_S_RegisterSound( "sound/world/teleout.wav", qfalse );	cgs.media.respawnSound = trap_S_RegisterSound( "sound/items/respawn1.wav", qfalse );	cgs.media.noAmmoSound = trap_S_RegisterSound( "sound/weapons/noammo.wav", qfalse );	cgs.media.talkSound = trap_S_RegisterSound( "sound/player/talk.wav", qfalse );	cgs.media.landSound = trap_S_RegisterSound( "sound/player/land1.wav", qfalse);	cgs.media.hitSound = trap_S_RegisterSound( "sound/feedback/hit.wav", qfalse );	cgs.media.impressiveSound = trap_S_RegisterSound( "sound/feedback/impressive.wav", qtrue );	cgs.media.excellentSound = trap_S_RegisterSound( "sound/feedback/excellent.wav", qtrue );	cgs.media.deniedSound = trap_S_RegisterSound( "sound/feedback/denied.wav", qtrue );	cgs.media.humiliationSound = trap_S_RegisterSound( "sound/feedback/humiliation.wav", qtrue );	cgs.media.assistSound = trap_S_RegisterSound( "sound/feedback/assist.wav", qtrue );	cgs.media.defendSound = trap_S_RegisterSound( "sound/feedback/defense.wav", qtrue );	cgs.media.takenLeadSound = trap_S_RegisterSound( "sound/feedback/takenlead.wav", qtrue);	cgs.media.tiedLeadSound = trap_S_RegisterSound( "sound/feedback/tiedlead.wav", qtrue);	cgs.media.lostLeadSound = trap_S_RegisterSound( "sound/feedback/lostlead.wav", qtrue);	cgs.media.watrInSound = trap_S_RegisterSound( "sound/player/watr_in.wav", qfalse);	cgs.media.watrOutSound = trap_S_RegisterSound( "sound/player/watr_out.wav", qfalse);	cgs.media.watrUnSound = trap_S_RegisterSound( "sound/player/watr_un.wav", qfalse);	cgs.media.jumpPadSound = trap_S_RegisterSound ("sound/world/jumppad.wav", qfalse );	for (i=0 ; i<4 ; i++) {		Com_sprintf (name, sizeof(name), "sound/player/footsteps/step%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_NORMAL][i] = trap_S_RegisterSound (name, qfalse);		Com_sprintf (name, sizeof(name), "sound/player/footsteps/boot%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_BOOT][i] = trap_S_RegisterSound (name, qfalse);		Com_sprintf (name, sizeof(name), "sound/player/footsteps/flesh%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_FLESH][i] = trap_S_RegisterSound (name, qfalse);		Com_sprintf (name, sizeof(name), "sound/player/footsteps/mech%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_MECH][i] = trap_S_RegisterSound (name, qfalse);		Com_sprintf (name, sizeof(name), "sound/player/footsteps/energy%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_ENERGY][i] = trap_S_RegisterSound (name, qfalse);		Com_sprintf (name, sizeof(name), "sound/player/footsteps/splash%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_SPLASH][i] = trap_S_RegisterSound (name, qfalse);		Com_sprintf (name, sizeof(name), "sound/player/footsteps/clank%i.wav", i+1);		cgs.media.footsteps[FOOTSTEP_METAL][i] = trap_S_RegisterSound (name, qfalse);	}	// only register the items that the server says we need	strcpy( items, CG_ConfigString( CS_ITEMS ) );	for ( i = 1 ; i < bg_numItems ; i++ ) {//		if ( items[ i ] == '1' || cg_buildScript.integer ) {			CG_RegisterItemSounds( i );//		}	}	for ( i = 1 ; i < MAX_SOUNDS ; i++ ) {		soundName = CG_ConfigString( CS_SOUNDS+i );		if ( !soundName[0] ) {			break;		}		if ( soundName[0] == '*' ) {			continue;	// custom sound		}		cgs.gameSounds[i] = trap_S_RegisterSound( soundName, qfalse );	}	// FIXME: only needed with item	cgs.media.flightSound = trap_S_RegisterSound( "sound/items/flight.wav", qfalse );	cgs.media.medkitSound = trap_S_RegisterSound ("sound/items/use_medkit.wav", qfalse);	cgs.media.quadSound = trap_S_RegisterSound("sound/items/damage3.wav", qfalse);	cgs.media.sfx_ric1 = trap_S_RegisterSound ("sound/weapons/machinegun/ric1.wav", qfalse);	cgs.media.sfx_ric2 = trap_S_RegisterSound ("sound/weapons/machinegun/ric2.wav", qfalse);	cgs.media.sfx_ric3 = trap_S_RegisterSound ("sound/weapons/machinegun/ric3.wav", qfalse);	cgs.media.sfx_railg = trap_S_RegisterSound ("sound/weapons/railgun/railgf1a.wav", qfalse);	cgs.media.sfx_rockexp = trap_S_RegisterSound ("sound/weapons/rocket/rocklx1a.wav", qfalse);	cgs.media.sfx_plasmaexp = trap_S_RegisterSound ("sound/weapons/plasma/plasmx1a.wav", qfalse);	cgs.media.regenSound = trap_S_RegisterSound("sound/items/regen.wav", qfalse);	cgs.media.protectSound = trap_S_RegisterSound("sound/items/protect3.wav", qfalse);	cgs.media.n_healthSound = trap_S_RegisterSound("sound/items/n_health.wav", qfalse );	cgs.media.hgrenb1aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb1a.wav", qfalse);	cgs.media.hgrenb2aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb2a.wav", qfalse);}
开发者ID:Clever-Boy,项目名称:entityplus,代码行数:101,


示例2: WM_DrawObjectives

int WM_DrawObjectives( int x, int y, int width, float fade ) {	const char *s, *str;	int tempy, rows;	int msec, mins, seconds, tens; // JPW NERVE	vec4_t tclr =	{ 0.6f,		0.6f,		0.6f,		1.0f };	if ( cg.snap->ps.pm_type == PM_INTERMISSION ) {		const char *s, *buf, *shader = NULL, *flagshader = NULL, *nameshader = NULL;		// Moved to CG_DrawIntermission/*		static int doScreenshot = 0, doDemostop = 0;		// OSP - End-of-level autoactions		if(!cg.demoPlayback) {			if(!cg.latchVictorySound) {				if(cg_autoAction.integer & AA_SCREENSHOT) {					doScreenshot = cg.time + 1000;				}				if(cg_autoAction.integer & AA_STATSDUMP) {					CG_dumpStats_f();				}				if((cg_autoAction.integer & AA_DEMORECORD) && (cgs.gametype == GT_WOLF_STOPWATCH && cgs.currentRound != 1)) {					doDemostop = cg.time + 5000;	// stats should show up within 5 seconds				}			}			if(doScreenshot > 0 && doScreenshot < cg.time) {				CG_autoScreenShot_f();				doScreenshot = 0;			}			if(doDemostop > 0 && doDemostop < cg.time) {				trap_SendConsoleCommand("stoprecord/n");				doDemostop = 0;			}		}*/		rows = 8;		y += SMALLCHAR_HEIGHT * ( rows - 1 );		s = CG_ConfigString( CS_MULTI_MAPWINNER );		buf = Info_ValueForKey( s, "winner" );		if ( atoi( buf ) == -1 )			str = "ITS A TIE!";		else if ( atoi( buf ) ) {			str = "ALLIES";//			shader = "ui/assets/portraits/allies_win";			flagshader = "ui/assets/portraits/allies_win_flag.tga";			nameshader = "ui/assets/portraits/text_allies.tga";/*			if ( !cg.latchVictorySound ) {				cg.latchVictorySound = qtrue;				trap_S_StartLocalSound( trap_S_RegisterSound( "sound/music/allies_win.wav", qtrue ), CHAN_LOCAL_SOUND );	// FIXME: stream			}*/		}		else {			str = "AXIS";//			shader = "ui/assets/portraits/axis_win";			flagshader = "ui/assets/portraits/axis_win_flag.tga";			nameshader = "ui/assets/portraits/text_axis.tga";/*			if ( !cg.latchVictorySound ) {				cg.latchVictorySound = qtrue;				trap_S_StartLocalSound( trap_S_RegisterSound( "sound/music/axis_win.wav", qtrue ), CHAN_LOCAL_SOUND );	// FIXME: stream			}*/		}		y += SMALLCHAR_HEIGHT * ( ( rows - 2 ) / 2 );		if ( flagshader ) {			CG_DrawPic( 100, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) );			CG_DrawPic( 325, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) );		}		if ( shader )			CG_DrawPic( 229, 10, 182, 136, trap_R_RegisterShaderNoMip( shader ) );		if ( nameshader ) {			CG_DrawPic( 140, 50, 127, 64, trap_R_RegisterShaderNoMip( nameshader ) );			CG_DrawPic( 365, 50, 127, 64, trap_R_RegisterShaderNoMip( "ui/assets/portraits/text_win.tga" ) );		}		return y;	}// JPW NERVE -- mission time & reinforce time	else {		tempy = y;		rows = 1;		CG_FillRect( x-5, y-2, width+5, 21, clrUiBack );		CG_FillRect( x-5, y-2, width+5, 21, clrUiBar );		CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack );		y += SMALLCHAR_HEIGHT * ( rows - 1 );		if( cgs.timelimit > 0.0f ) {			msec = ( cgs.timelimit * 60.f * 1000.f ) - ( cg.time - cgs.levelStartTime );			seconds = msec / 1000;			mins = seconds / 60;			seconds -= mins * 60;			tens = seconds / 10;			seconds -= tens * 10;		} else {//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,


示例3: CG_Obituary

/*=============CG_Obituary=============*/static void CG_Obituary( entityState_t *ent ) {	int			mod;	int			target, attacker;	char		*message;	char		*message2;	const char	*targetInfo;	const char	*attackerInfo;	char		targetName[32];	char		attackerName[32];	gender_t	gender;	clientInfo_t	*ci;	target = ent->otherEntityNum;	attacker = ent->otherEntityNum2;	mod = ent->eventParm;	if ( target < 0 || target >= MAX_CLIENTS ) {		CG_Error( "CG_Obituary: target out of range" );	}	ci = &cgs.clientinfo[target];	if ( attacker < 0 || attacker >= MAX_CLIENTS ) {		attacker = ENTITYNUM_WORLD;		attackerInfo = NULL;	} else {		attackerInfo = CG_ConfigString( CS_PLAYERS + attacker );	}	targetInfo = CG_ConfigString( CS_PLAYERS + target );	if ( !targetInfo ) {		return;	}	Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof(targetName) - 2);	strcat( targetName, S_COLOR_WHITE );	message2 = "";	// check for single client messages	switch( mod ) {	case MOD_SUICIDE:		message = "suicides";		break;	case MOD_FALLING:		message = "cratered";		break;	case MOD_CRUSH:		message = "was squished";		break;	case MOD_WATER:		message = "sank like a rock";		break;	case MOD_SLIME:		message = "melted";		break;	case MOD_LAVA:		message = "does a back flip into the lava";		break;	case MOD_TARGET_LASER:		message = "saw the light";		break;	case MOD_TRIGGER_HURT:		message = "was in the wrong place";		break;	default:		message = NULL;		break;	}	if (attacker == target) {		gender = ci->gender;		switch (mod) {#ifdef MISSIONPACK		case MOD_KAMIKAZE:			message = "goes out with a bang";			break;#endif		case MOD_GRENADE_SPLASH:			if ( gender == GENDER_FEMALE )				message = "tripped on her own grenade";			else if ( gender == GENDER_NEUTER )				message = "tripped on its own grenade";			else				message = "tripped on his own grenade";			break;		case MOD_ROCKET_SPLASH:			if ( gender == GENDER_FEMALE )				message = "blew herself up";			else if ( gender == GENDER_NEUTER )				message = "blew itself up";			else				message = "blew himself up";			break;		case MOD_PLASMA_SPLASH:			if ( gender == GENDER_FEMALE )//.........这里部分代码省略.........
开发者ID:donald-hanson,项目名称:battle-of-the-sexes,代码行数:101,


示例4: CG_NewParticleArea

int CG_NewParticleArea(int num){	// const char *str;	char           *str;	char           *token;	int             type;	vec3_t          origin, origin2;	int             i;	float           range = 0;	int             turb;	int             numparticles;	int             snum;	str = (char *)CG_ConfigString(num);	if(!str[0])	{		return (0);	}	// returns type 128 64 or 32	token = COM_Parse(&str);	type = atoi(token);	if(type == 1)	{		range = 128;	}	else if(type == 2)	{		range = 64;	}	else if(type == 3)	{		range = 32;	}	else if(type == 0)	{		range = 256;	}	else if(type == 4)	{		range = 8;	}	else if(type == 5)	{		range = 16;	}	else if(type == 6)	{		range = 32;	}	else if(type == 7)	{		range = 64;	}	for(i = 0; i < 3; i++)	{		token = COM_Parse(&str);		origin[i] = atof(token);	}	for(i = 0; i < 3; i++)	{		token = COM_Parse(&str);		origin2[i] = atof(token);	}	token = COM_Parse(&str);	numparticles = atoi(token);	token = COM_Parse(&str);	turb = atoi(token);	token = COM_Parse(&str);	snum = atoi(token);	for(i = 0; i < numparticles; i++)	{		if(type >= 4)		{			CG_ParticleBubble(cgs.media.waterBubbleShader, origin, origin2, turb, range, snum);		}		else		{			CG_ParticleSnow(cgs.media.snowShader, origin, origin2, turb, range, snum);		}	}	return (1);}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:92,


示例5: TurretClientRun

void TurretClientRun(centity_t *ent){	if (!ent->ghoul2)	{		weaponInfo_t	*weaponInfo;		trap_G2API_InitGhoul2Model(&ent->ghoul2, CG_ConfigString( CS_MODELS+ent->currentState.modelindex ), 0, 0, 0, 0, 0);		if (!ent->ghoul2)		{ //bad			return;		}		ent->torsoBolt = trap_G2API_AddBolt( ent->ghoul2, 0, "*flash02" );		trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg->time ); 		trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_gback", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg->time ); 		trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_barrel", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg->time ); 		trap_G2API_SetBoneAnim( ent->ghoul2, 0, "model_root", 0, 11, BONE_ANIM_OVERRIDE_FREEZE, 0.8f, cg->time, 0, 0 );		ent->turAngles[ROLL] = 0;		ent->turAngles[PITCH] = 90;		ent->turAngles[YAW] = 0;		weaponInfo = &cg_weapons[WP_TURRET];		if ( !weaponInfo->registered )		{			CG_RegisterWeapon(WP_TURRET);		}	}	if (ent->currentState.fireflag == 2)	{ //I'm about to blow		if (ent->turAngles)		{			trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", ent->turAngles, BONE_ANGLES_REPLACE, NEGATIVE_Y, NEGATIVE_Z, NEGATIVE_X, NULL, 100, cg->time ); 		}		return;	}	else if (ent->currentState.fireflag && ent->bolt4 != ent->currentState.fireflag)	{		vec3_t muzzleOrg, muzzleDir;		mdxaBone_t boltMatrix;		trap_G2API_GetBoltMatrix(ent->ghoul2, 0, ent->torsoBolt, &boltMatrix, /*ent->lerpAngles*/vec3_origin, ent->lerpOrigin, cg->time, cgs.gameModels, ent->modelScale);		BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, muzzleOrg);		BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_X, muzzleDir);		trap_FX_PlayEffectID(cgs.effects.mTurretMuzzleFlash, muzzleOrg, muzzleDir, -1, -1);		ent->bolt4 = ent->currentState.fireflag;	}	else if (!ent->currentState.fireflag)	{		ent->bolt4 = 0;	}	if (ent->currentState.bolt2 != ENTITYNUM_NONE)	{ //turn toward the enemy		centity_t *enemy = &cg_entities[ent->currentState.bolt2];		if (enemy)		{			vec3_t enAng;			vec3_t enPos;			VectorCopy(enemy->currentState.pos.trBase, enPos);			VectorSubtract(enPos, ent->lerpOrigin, enAng);			VectorNormalize(enAng);			vectoangles(enAng, enAng);			enAng[ROLL] = 0;			enAng[PITCH] += 90;			CreepToPosition(enAng, ent->turAngles);		}	}	else	{		vec3_t idleAng;		float turnAmount;		if (ent->turAngles[YAW] > 360)		{			ent->turAngles[YAW] -= 361;		}		if (!ent->dustTrailTime)		{			ent->dustTrailTime = cg->time;		}		turnAmount = (cg->time-ent->dustTrailTime)*0.03;		if (turnAmount > 360)		{			turnAmount = 360;		}//.........这里部分代码省略.........
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:101,


示例6: CG_ConfigStringModified

/*================CG_ConfigStringModified================*/static void CG_ConfigStringModified( void ) {	const char	*str;	int		num;	num = atoi( CG_Argv( 1 ) );	// get the gamestate from the client system, which will have the	// new configstring already integrated	trap_GetGameState( &cgs.gameState );	// look up the individual string that was modified	str = CG_ConfigString( num );	// do something with it if necessary	if ( num == CS_MUSIC ) {		CG_StartMusic();	} else if ( num == CS_SERVERINFO ) {		CG_ParseServerinfo();	} else if ( num == CS_WARMUP ) {		CG_ParseWarmup();	} else if ( num == CS_SCORES1 ) {		cgs.scores1 = atoi( str );	} else if ( num == CS_SCORES2 ) {		cgs.scores2 = atoi( str );	} else if ( num == CS_LEVEL_START_TIME ) {		cgs.levelStartTime = atoi( str );	} else if ( num == CS_VOTE_TIME ) {		cgs.voteTime = atoi( str );		cgs.voteModified = qtrue;	} else if ( num == CS_VOTE_YES ) {		cgs.voteYes = atoi( str );		cgs.voteModified = qtrue;	} else if ( num == CS_VOTE_NO ) {		cgs.voteNo = atoi( str );		cgs.voteModified = qtrue;	} else if ( num == CS_VOTE_STRING ) {		Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) );#ifdef MISSIONPACK		trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER );#endif //MISSIONPACK	} else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) {		cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str );		cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue;	} else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) {		cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str );		cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue;	} else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) {		cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str );		cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue;	} else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) {		Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) );#ifdef MISSIONPACK		trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER );#endif	} else if ( num == CS_INTERMISSION ) {		cg.intermissionStarted = atoi( str );	} else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) {		cgs.gameModels[ num-CS_MODELS ] = trap_R_RegisterModel( str );	} else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_MODELS ) {		if ( str[0] != '*' ) {	// player specific sounds don't register here			cgs.gameSounds[ num-CS_SOUNDS] = trap_S_RegisterSound( str, qfalse );		}	} else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) {		CG_NewClientInfo( num - CS_PLAYERS );		CG_BuildSpectatorString();	} else if ( num == CS_FLAGSTATUS ) {		if( cgs.gametype == GT_CTF ) {			// format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped			cgs.redflag = str[0] - '0';			cgs.blueflag = str[1] - '0';		}#ifdef MISSIONPACK		else if( cgs.gametype == GT_1FCTF ) {			cgs.flagStatus = str[0] - '0';		}#endif	}	else if ( num == CS_SHADERSTATE ) {		CG_ShaderStateChanged();	}}
开发者ID:linux26,项目名称:corkscrew,代码行数:88,


示例7: CG_HandleNPCSounds

void CG_HandleNPCSounds(centity_t *cent){	if (!cent->npcClient)	{		return;	}	//standard	if (cent->currentState.csSounds_Std)	{		const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Std );		if (s && s[0])		{			char sEnd[MAX_QPATH];			int i = 2;			int j = 0;			//Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates			//it is an NPC custom sound dir.			while (s[i])			{				sEnd[j] = s[i];				j++;				i++;			}			sEnd[j] = 0;			CG_RegisterCustomSounds(cent->npcClient, 1, sEnd);		}	}	else	{		memset(&cent->npcClient->sounds, 0, sizeof(cent->npcClient->sounds));	}	//combat	if (cent->currentState.csSounds_Combat)	{		const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Combat );		if (s && s[0])		{			char sEnd[MAX_QPATH];			int i = 2;			int j = 0;			//Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates			//it is an NPC custom sound dir.			while (s[i])			{				sEnd[j] = s[i];				j++;				i++;			}			sEnd[j] = 0;			CG_RegisterCustomSounds(cent->npcClient, 2, sEnd);		}	}	else	{		memset(&cent->npcClient->combatSounds, 0, sizeof(cent->npcClient->combatSounds));	}	//extra	if (cent->currentState.csSounds_Extra)	{		const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Extra );		if (s && s[0])		{			char sEnd[MAX_QPATH];			int i = 2;			int j = 0;			//Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates			//it is an NPC custom sound dir.			while (s[i])			{				sEnd[j] = s[i];				j++;				i++;			}			sEnd[j] = 0;			CG_RegisterCustomSounds(cent->npcClient, 3, sEnd);		}	}	else	{		memset(&cent->npcClient->extraSounds, 0, sizeof(cent->npcClient->extraSounds));	}	//jedi	if (cent->currentState.csSounds_Jedi)	{		const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Jedi );		if (s && s[0])//.........这里部分代码省略.........
开发者ID:JKGDevs,项目名称:JediKnightGalaxies,代码行数:101,


示例8: CG_DrawInformation

/*====================CG_DrawInformationDraw all the status / pacifier stuff during level loading====================*/void CG_DrawInformation(void){	const char	*s;	const char	*info;	const char	*sysInfo;	int			y;	int			value;	qhandle_t	levelshot;	qhandle_t	detail;	char		buf[1024];	info = CG_ConfigString(CS_SERVERINFO);	sysInfo = CG_ConfigString(CS_SYSTEMINFO);	s = Info_ValueForKey(info, "mapname");	levelshot = trap_R_RegisterShaderNoMip(va("levelshots/%s.tga", s));	if (!levelshot)	{		levelshot = trap_R_RegisterShaderNoMip("menu/art/unknownmap");	}	trap_R_SetColor(NULL);	CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot);	// blend a detail texture over it	detail = trap_R_RegisterShader("levelShotDetail");	trap_R_DrawStretchPic(0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail);	// draw the icons of things as they are loaded	CG_DrawLoadingIcons();	// the first 150 rows are reserved for the client connection	// screen to write into	if (cg.infoScreenText[0])	{		UI_DrawProportionalString(320, 128-32, va("Loading... %s", cg.infoScreenText),			UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite);	}	else	{		UI_DrawProportionalString(320, 128-32, "Awaiting snapshot...",			UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite);	}	// draw info string information	y = 180-32;	// don't print server lines if playing a local game	trap_Cvar_VariableStringBuffer("sv_running", buf, sizeof(buf));	if (!atoi(buf))	{		// server hostname		Q_strncpyz(buf, Info_ValueForKey(info, "sv_hostname"), 1024);		Q_CleanStr(buf);		UI_DrawProportionalString(320, y, buf,			UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite);		y += PROP_HEIGHT;		// pure server		s = Info_ValueForKey(sysInfo, "sv_pure");		if (s[0] == '1')		{			UI_DrawProportionalString(320, y, "Pure Server",				UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite);			y += PROP_HEIGHT;		}		// server-specific message of the day		s = CG_ConfigString(CS_MOTD);		if (s[0])		{			UI_DrawProportionalString(320, y, s,				UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite);			y += PROP_HEIGHT;		}		// some extra space after hostname and motd		y += 10;	}	// map-specific message (long map name)	s = CG_ConfigString(CS_MESSAGE);	if (s[0])	{		UI_DrawProportionalString(320, y, s,			UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite);		y += PROP_HEIGHT;	}	// cheats warning	s = Info_ValueForKey(sysInfo, "sv_cheats");	if (s[0] == '1')	{//.........这里部分代码省略.........
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:101,


示例9: CG_LoadingClient

/*===================CG_LoadingClient===================*/void CG_LoadingClient(int clientNum){	const char		*info;	char			*skin;	char			personality[MAX_QPATH];	char			model[MAX_QPATH];	char			iconName[MAX_QPATH];	info = CG_ConfigString(CS_PLAYERS + clientNum);	if (loadingPlayerIconCount < MAX_LOADING_PLAYER_ICONS)	{		Q_strncpyz(model, Info_ValueForKey(info, "model"), sizeof(model));		skin = Q_strrchr(model, '/');		if (skin)		{			*skin++ = '/0';		}		else		{			switch (atoi(Info_ValueForKey(info, "t")))			{				case TEAM_BLUE:					skin = "default";					break;				default:					skin = "red";					break;			}		}		if (!model[0])			strcpy(model, DEFAULT_MODEL);		Com_sprintf(iconName, MAX_QPATH, "models/players/%s/icon_%s.tga", model, skin);		loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip(iconName);		if (!loadingPlayerIcons[loadingPlayerIconCount])		{			Com_sprintf( iconName, MAX_QPATH, "models/players/characters/%s/icon_%s.tga", model, skin );			loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName );		}		if (!loadingPlayerIcons[loadingPlayerIconCount])		{			Com_sprintf(iconName, MAX_QPATH, "models/players/%s/icon_%s.tga", DEFAULT_MODEL, "default");			loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip(iconName);		}		if (loadingPlayerIcons[loadingPlayerIconCount])		{			loadingPlayerIconCount++;		}	}	Q_strncpyz(personality, Info_ValueForKey(info, "n"), sizeof(personality));	Q_CleanStr(personality);	if (cgs.gametype == GT_SINGLE_PLAYER)	{		trap_S_RegisterSound(va("sound/player/announce/%s.wav", personality), qtrue);	}	CG_LoadingString(personality);}
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:68,


示例10: CG_LQMObituary

/*=============CG_GroundVehicleObituaryGeneral ugly function, needs to be made prettier some day...=============*/void CG_LQMObituary( entityState_t *ent, clientInfo_t *ci ) {	// add some cool stuff here :-)    int			mod;    int			target, attacker;    char		*message;    char		*message2;    const char	*targetInfo;    const char	*attackerInfo;    char		targetName[32];    char		attackerName[32];    gender_t	gender;    target = ent->otherEntityNum;    attacker = ent->otherEntityNum2;    mod = ent->eventParm;    if ( attacker < 0 || attacker >= MAX_CLIENTS ) {	    attacker = ENTITYNUM_WORLD;	    attackerInfo = NULL;    } else {	    attackerInfo = CG_ConfigString( CS_PLAYERS + attacker );    }    targetInfo = CG_ConfigString( CS_PLAYERS + target );    if ( !targetInfo ) {	    return;    }#pragma message("remove the problem checking here!")	if( Info_ValueForKey( targetInfo, "n" ) != 0 ) {		Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof(targetName) - 2);	}	else {		Com_Error( ERR_DROP, "MFQ3 Error (3): Invalid targetinfo/n" );	}	    strcat( targetName, S_COLOR_WHITE );    message2 = "";    // check for single client messages    switch( mod ) {    case MOD_SUICIDE:	    message = "suicides";	    break;    case MOD_FALLING:	    message = "cratered";	    break;    case MOD_CRUSH:	    message = "was squished";	    break;    case MOD_WATER:	    message = "sank like a rock";	    break;    case MOD_SLIME:	    message = "melted";	    break;    case MOD_LAVA:	    message = "does a back flip into the lava";	    break;    default:	    message = NULL;	    break;    }    if (attacker == target) {	gender = ci->gender;	switch (mod) {	case MOD_CRASH:		message = "was unable to control his vehicle";		break;	default:		if ( gender == GENDER_FEMALE )			message = "killed herself";		else if ( gender == GENDER_NEUTER )			message = "killed itself";		else			message = "killed himself";		break;	}    }    if (message) {	    CG_Printf( "%s %s./n", targetName, message);	    return;    }    // check for kill messages from the current clientNum    if ( attacker == cg.snap->ps.clientNum ) {	char	*s;	if ( cgs.gametype < GT_TEAM ) {//.........这里部分代码省略.........
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:101,


示例11: CG_DrawInformation

void CG_DrawInformation( void ) {	const char	*s;	const char	*info;	const char	*sysInfo;	int			y;	int			value, valueNOFP;	qhandle_t	levelshot;	char		buf[1024];	int			iPropHeight = 18;	// I know, this is total crap, but as a post release asian-hack....  -Ste	info = CG_ConfigString( CS_SERVERINFO );	sysInfo = CG_ConfigString( CS_SYSTEMINFO );	s = Info_ValueForKey( info, "mapname" );	levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) );	if ( !levelshot ) {		levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" );	}	trap_R_SetColor( NULL );	CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );	CG_LoadBar();	// draw the icons of things as they are loaded//	CG_DrawLoadingIcons();	// the first 150 rows are reserved for the client connection	// screen to write into	if ( cg.infoScreenText[0] ) {		const char *psLoading = CG_GetStripEdString("MENUS3", "LOADING_MAPNAME");		UI_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ psLoading, cg.infoScreenText),			UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );	} else {		const char *psAwaitingSnapshot = CG_GetStripEdString("MENUS3", "AWAITING_SNAPSHOT");		UI_DrawProportionalString( 320, 128-32, /*"Awaiting snapshot..."*/psAwaitingSnapshot,			UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );	}	// draw info string information	y = 180-32;	// don't print server lines if playing a local game	trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) );	if ( !atoi( buf ) ) {		// server hostname		Q_strncpyz(buf, Info_ValueForKey( info, "sv_hostname" ), 1024);		Q_CleanStr(buf);		UI_DrawProportionalString( 320, y, buf,			UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );		y += iPropHeight;		// pure server		s = Info_ValueForKey( sysInfo, "sv_pure" );		if ( s[0] == '1' ) {			const char *psPure = CG_GetStripEdString("INGAMETEXT", "PURE_SERVER");			UI_DrawProportionalString( 320, y, psPure,				UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );			y += iPropHeight;		}		// server-specific message of the day		s = CG_ConfigString( CS_MOTD );		if ( s[0] ) {			UI_DrawProportionalString( 320, y, s,				UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );			y += iPropHeight;		}		{	// display global MOTD at bottom (mirrors ui_main UI_DrawConnectScreen			char motdString[1024];			trap_Cvar_VariableStringBuffer( "cl_motdString", motdString, sizeof( motdString ) );			if (motdString[0])			{				UI_DrawProportionalString( 320, 425, motdString,					UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );			}		}		// some extra space after hostname and motd		y += 10;	}	// map-specific message (long map name)	s = CG_ConfigString( CS_MESSAGE );	if ( s[0] ) {		UI_DrawProportionalString( 320, y, s,			UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );		y += iPropHeight;	}	// cheats warning	s = Info_ValueForKey( sysInfo, "sv_cheats" );	if ( s[0] == '1' ) {		UI_DrawProportionalString( 320, y, CG_GetStripEdString("INGAMETEXT", "CHEATSAREENABLED"),			UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );		y += iPropHeight;	}//.........这里部分代码省略.........
开发者ID:aufau,项目名称:jk2sdk-gpl-fork,代码行数:101,


示例12: CG_DrawConnectScreen

void CG_DrawConnectScreen(qboolean interactive, qboolean forcerefresh){    static qboolean inside = qfalse;    char            buffer[1024];    bg_loadscreeninteractive = interactive;    if (!DC)    {        return;    }    if (inside)    {        return;    }    inside = qtrue;    if (!bg_loadscreeninited)    {        trap_Cvar_Set("ui_connecting", "0");        DC->registerFont("ariblk", 27, &bg_loadscreenfont1);        DC->registerFont("courbd", 30, &bg_loadscreenfont2);        bg_axispin    = DC->registerShaderNoMip("gfx/loading/pin_axis");        bg_alliedpin  = DC->registerShaderNoMip("gfx/loading/pin_allied");        bg_neutralpin = DC->registerShaderNoMip("gfx/loading/pin_neutral");        bg_pin        = DC->registerShaderNoMip("gfx/loading/pin_shot");        bg_filter_bo = DC->registerShaderNoMip("ui/assets/filter_bots");        bg_filter_ff = DC->registerShaderNoMip("ui/assets/filter_ff");        bg_filter_hw = DC->registerShaderNoMip("ui/assets/filter_weap");        bg_filter_lv = DC->registerShaderNoMip("ui/assets/filter_lives");        bg_filter_al = DC->registerShaderNoMip("ui/assets/filter_antilag");        bg_filter_bt = DC->registerShaderNoMip("ui/assets/filter_balance");        bg_mappic = 0;        BG_PanelButtonsSetup(loadpanelButtons);        C_PanelButtonsSetup(loadpanelButtons, cgs.wideXoffset);        bg_loadscreeninited = qtrue;    }    BG_PanelButtonsRender(loadpanelButtons);    if (interactive)    {        DC->drawHandlePic(DC->cursorx, DC->cursory, 32, 32, DC->Assets.cursor);    }    DC->getConfigString(CS_SERVERINFO, buffer, sizeof(buffer));    if (*buffer)    {        const char *str;        float      x = 540.0f + cgs.wideXoffset;        float      y = 322;        int        i;        qboolean   enabled = qfalse;        CG_Text_Paint_Centred_Ext(x, y, 0.22f, 0.22f, clr3, ("^1" LEGACY_MOD " ^0" LEGACY_MOD_VERSION), 0, 0, 0, &bg_loadscreenfont1);        y   = 340;        str = Info_ValueForKey(buffer, "sv_hostname");        CG_Text_Paint_Centred_Ext(x, y, 0.2f, 0.2f, colorWhite, str && *str ? str : "ETHost", 0, 26, 0, &bg_loadscreenfont2);        y += 14;        for (i = 0; i < MAX_MOTDLINES; i++)        {            str = CG_ConfigString(CS_CUSTMOTD + i);            if (!str || !*str)            {                break;            }            CG_Text_Paint_Centred_Ext(x, y, 0.2f, 0.2f, colorWhite, str, 0, 26, 0, &bg_loadscreenfont2);            y += 10;        }        y = 417;        str = Info_ValueForKey(buffer, "g_friendlyfire");        if (str && *str && atoi(str))        {            x = 461 + cgs.wideXoffset;            CG_DrawPic(x, y, 16, 16, bg_filter_ff);        }        if (atoi(Info_ValueForKey(buffer, "g_gametype")) != GT_WOLF_LMS)        {            str = Info_ValueForKey(buffer, "g_maxlives");            if (str && *str && atoi(str))            {                enabled = qtrue;            }//.........这里部分代码省略.........
开发者ID:Ponce,项目名称:etlegacy,代码行数:101,


示例13: CG_DrawOldTourneyScoreboard

/*=================CG_DrawTourneyScoreboardDraw the oversize scoreboard for tournements=================*/void CG_DrawOldTourneyScoreboard( void ) {	const char		*s;	vec4_t			color;	int				min, tens, ones;	clientInfo_t	*ci;	int				y;	int				i;	// request more scores regularly	if ( cg.scoresRequestTime + 2000 < cg.time ) {		cg.scoresRequestTime = cg.time;		_CG_trap_SendClientCommand( "score" );	}	color[0] = GFIXED_1;	color[1] = GFIXED_1;	color[2] = GFIXED_1;	color[3] = GFIXED_1;	// draw the dialog background	color[0] = color[1] = color[2] = GFIXED_0;	color[3] = GFIXED_1;	CG_FillRect( GFIXED_0, GFIXED_0, GFIXED(SCREEN_WIDTH,0), GFIXED(SCREEN_HEIGHT,0), color );	// print the mesage of the day	s = CG_ConfigString( CS_MOTD );	if ( !s[0] ) {		s = "Scoreboard";	}	// print optional title	CG_CenterGiantLine( GFIXED(8,0), s );	// print server time	ones = cg.time / 1000;	min = ones / 60;	ones %= 60;	tens = ones / 10;	ones %= 10;	s = va("%i:%i%i", min, tens, ones );	CG_CenterGiantLine( GFIXED(64,0), s );	// print the two scores	y = 160;	if ( cgs.gametype >= GT_TEAM ) {		//		// teamplay scoreboard		//		CG_DrawStringExt( 8, y, "Red Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );		s = va("%i", cg.teamScores[0] );		CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );				y += 64;		CG_DrawStringExt( 8, y, "Blue Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );		s = va("%i", cg.teamScores[1] );		CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );	} else {		//		// free for all scoreboard		//		for ( i = 0 ; i < MAX_CLIENTS ; i++ ) {			ci = &cgs.clientinfo[i];			if ( !ci->infoValid ) {				continue;			}			if ( ci->team != TEAM_FREE ) {				continue;			}			CG_DrawStringExt( 8, y, ci->name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );			s = va("%i", ci->score );			CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );			y += 64;		}	}}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:89,


示例14: CG_RegisterGraphics

/*=================CG_RegisterGraphicsThis function may execute for a couple of minutes with a slow disk.=================*/static void CG_RegisterGraphics( void ) {	gitem_t		*backpack;	int			i;	char		items[MAX_ITEMS+1];	static char		*sb_nums[11] = {		"gfx/2d/numbers/zero_32b",		"gfx/2d/numbers/one_32b",		"gfx/2d/numbers/two_32b",		"gfx/2d/numbers/three_32b",		"gfx/2d/numbers/four_32b",		"gfx/2d/numbers/five_32b",		"gfx/2d/numbers/six_32b",		"gfx/2d/numbers/seven_32b",		"gfx/2d/numbers/eight_32b",		"gfx/2d/numbers/nine_32b",		"gfx/2d/numbers/minus_32b",	};	// clear any references to old media	memset( &cg.refdef, 0, sizeof( cg.refdef ) );	trap_R_ClearScene();	CG_LoadingString( cgs.mapname );	trap_R_LoadWorldMap( cgs.mapname );	// precache status bar pics	CG_LoadingString( "game media" );	for ( i=0 ; i<11 ; i++) {		cgs.media.numberShaders[i] = trap_R_RegisterShader( sb_nums[i] );	}	cgs.media.botSkillShaders[0] = trap_R_RegisterShader( "menu/art/skill1.tga" );	cgs.media.botSkillShaders[1] = trap_R_RegisterShader( "menu/art/skill2.tga" );	cgs.media.botSkillShaders[2] = trap_R_RegisterShader( "menu/art/skill3.tga" );	cgs.media.botSkillShaders[3] = trap_R_RegisterShader( "menu/art/skill4.tga" );	cgs.media.botSkillShaders[4] = trap_R_RegisterShader( "menu/art/skill5.tga" );	cgs.media.viewBloodShader = trap_R_RegisterShader( "viewBloodBlend" );	cgs.media.deferShader = trap_R_RegisterShaderNoMip( "gfx/2d/defer.tga" );	cgs.media.scoreboardName = trap_R_RegisterShaderNoMip( "menu/tab/name.tga" );	cgs.media.scoreboardPing = trap_R_RegisterShaderNoMip( "menu/tab/ping.tga" );	cgs.media.scoreboardScore = trap_R_RegisterShaderNoMip( "menu/tab/score.tga" );	cgs.media.scoreboardTime = trap_R_RegisterShaderNoMip( "menu/tab/time.tga" );	cgs.media.objectivesOverlay = trap_R_RegisterShaderNoMip( CG_ConfigString(CS_OBJECTIVESOVERLAY) );	cgs.media.objectivesUpdated = trap_R_RegisterShaderNoMip( "menu/objectives/updated.tga" );	cgs.media.objectivesUpdatedSound = trap_S_RegisterSound( "sound/misc/objective_update_01.wav", qfalse );	cgs.media.deathImage = trap_R_RegisterShaderNoMip( "menu/art/level_complete5" );	cgs.media.scoreShow = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse );	cgs.media.finalScoreShow = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse );	cgs.media.smokePuffShader = trap_R_RegisterShader( "smokePuff" );	cgs.media.smokePuffRageProShader = trap_R_RegisterShader( "smokePuffRagePro" );	cgs.media.shotgunSmokePuffShader = trap_R_RegisterShader( "shotgunSmokePuff" );	cgs.media.plasmaBallShader = trap_R_RegisterShader( "sprites/plasma1" );	cgs.media.bloodTrailShader = trap_R_RegisterShader( "bloodTrail" );	cgs.media.lagometerShader = trap_R_RegisterShader("lagometer" );	cgs.media.connectionShader = trap_R_RegisterShader( "disconnected" );	cgs.media.waterBubbleShader = trap_R_RegisterShader( "waterBubble" );	cgs.media.tracerShader = trap_R_RegisterShader( "gfx/misc/tracer" );	cgs.media.selectShader = trap_R_RegisterShader( "gfx/2d/select" );	for ( i = 0 ; i < NUM_CROSSHAIRS ; i++ ) {		cgs.media.crosshairShader[i] = trap_R_RegisterShader( va("gfx/2d/crosshair%c", 'a'+i) );	}	cgs.media.backTileShader = trap_R_RegisterShader( "gfx/2d/backtile" );	cgs.media.noammoShader = trap_R_RegisterShader( "icons/noammo" );	// powerup shaders	cgs.media.quadShader = trap_R_RegisterShader("powerups/quad" );	cgs.media.quadWeaponShader = trap_R_RegisterShader("powerups/quadWeapon" );	cgs.media.battleSuitShader = trap_R_RegisterShader("powerups/battleSuit" );	cgs.media.battleWeaponShader = trap_R_RegisterShader("powerups/battleWeapon" );	cgs.media.invisShader = trap_R_RegisterShader("powerups/invisibility" );	cgs.media.regenShader = trap_R_RegisterShader("powerups/regen" );	cgs.media.hastePuffShader = trap_R_RegisterShader("hasteSmokePuff" );	if ( cg_buildScript.integer ) {		cgs.media.redCubeModel = trap_R_RegisterModel( "models/powerups/orb/r_orb.md3" );		cgs.media.blueCubeModel = trap_R_RegisterModel( "models/powerups/orb/b_orb.md3" );		cgs.media.redCubeIcon = trap_R_RegisterShader( "icons/skull_red" );		cgs.media.blueCubeIcon = trap_R_RegisterShader( "icons/skull_blue" );	}//.........这里部分代码省略.........
开发者ID:Clever-Boy,项目名称:entityplus,代码行数:101,


示例15: CG_DrawSkyBoxPortal

/*==============CG_DrawSkyBoxPortal==============*/void CG_DrawSkyBoxPortal( void ) {	static float lastfov = 90;      // for transitions back from zoomed in modes	refdef_t backuprefdef;	float fov_x;	float fov_y;	float x;	char *cstr;	char *token;	float zoomFov;	float f;	static qboolean foginited = qfalse; // only set the portal fog values once	if ( !cg_skybox.integer ) {		return;	}	if ( !( cstr = (char *)CG_ConfigString( CS_SKYBOXORG ) ) || !strlen( cstr ) ) {		// no skybox in this map		return;	}	// if they are waiting at the mission stats screen, show the stats	if ( cg_gameType.integer == GT_SINGLE_PLAYER ) {		if ( strlen( cg_missionStats.string ) > 1 ) {			return;		}	}	backuprefdef = cg.refdef;	token = COM_ParseExt( &cstr, qfalse );	if ( !token || !token[0] ) {		CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring/n" );	}	cg.refdef.vieworg[0] = atof( token );	token = COM_ParseExt( &cstr, qfalse );	if ( !token || !token[0] ) {		CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring/n" );	}	cg.refdef.vieworg[1] = atof( token );	token = COM_ParseExt( &cstr, qfalse );	if ( !token || !token[0] ) {		CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring/n" );	}	cg.refdef.vieworg[2] = atof( token );	token = COM_ParseExt( &cstr, qfalse );	if ( !token || !token[0] ) {		CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring/n" );	}	fov_x = atoi( token );	if ( !fov_x ) {		fov_x = 90;	}	// setup fog the first time, ignore this part of the configstring after that	token = COM_ParseExt( &cstr, qfalse );	if ( !token || !token[0] ) {		CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog state/n" );	} else {		vec4_t fogColor;		int fogStart, fogEnd;		if ( atoi( token ) ) {   // this camera has fog			if ( !foginited ) {				token = COM_ParseExt( &cstr, qfalse );				if ( !token || !token[0] ) {					CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog[0]/n" );				}				fogColor[0] = atof( token );				token = COM_ParseExt( &cstr, qfalse );				if ( !token || !token[0] ) {					CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog[1]/n" );				}				fogColor[1] = atof( token );				token = COM_ParseExt( &cstr, qfalse );				if ( !token || !token[0] ) {					CG_Error( "CG_DrawSkyBoxPortal: error parsing skybox configstring.  No fog[2]/n" );				}				fogColor[2] = atof( token );				token = COM_ParseExt( &cstr, qfalse );				if ( !token || !token[0] ) {					fogStart = 0;				} else {					fogStart = atoi( token );				}				token = COM_ParseExt( &cstr, qfalse );//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,


示例16: CG_ParseServerinfo

/*================CG_ParseServerinfoThis is called explicitly when the gamestate is first received,and whenever the server updates any serverinfo flagged cvars================*/void CG_ParseServerinfo( void ) {	const char *info = NULL;	char *mapname;	int i, value;	info = CG_ConfigString( CS_SERVERINFO );	cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap->Cvar_GetHiddenVarValue("g_iknowkungfu");	cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) );	cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) );	cgs.siegeTeamSwitch = atoi( Info_ValueForKey( info, "g_siegeTeamSwitch" ) );	cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) );	cgs.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );	trap->Cvar_Set("g_gametype", va("%i", cgs.gametype));	cgs.needpass = atoi( Info_ValueForKey( info, "g_needpass" ) );	cgs.jediVmerc = atoi( Info_ValueForKey( info, "g_jediVmerc" ) );	// this changes on map_restart, attempt to precache weapons	value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) );	if ( cgs.wDisable != value ) {		gitem_t *item = NULL;		itemInfo_t *itemInfo = NULL;		cgs.wDisable = value;		for ( i=1, item=bg_itemlist, itemInfo = cg_items;			i<bg_numItems;			i++, item++, itemInfo++ )		{// register all weapons that aren't disabled			if ( item->giType == IT_WEAPON )				CG_RegisterWeapon( item->giTag );		}	}	cgs.fDisable = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) );	cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) );	cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) );	cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) );	// reset fraglimit warnings	i = atoi( Info_ValueForKey( info, "fraglimit" ) );	if ( cgs.fraglimit < i )		cg.fraglimitWarnings &= ~(1|2|4);	cgs.fraglimit = i;	// reset timelimit warnings	i = atoi( Info_ValueForKey( info, "timelimit" ) );	if ( cgs.timelimit != i )		cg.timelimitWarnings &= ~(1|2);	cgs.timelimit = i;	cgs.maxclients = Com_Clampi( 0, MAX_CLIENTS, atoi( Info_ValueForKey( info, "sv_maxclients" ) ) );	mapname = Info_ValueForKey( info, "mapname" );	//rww - You must do this one here, Info_ValueForKey always uses the same memory pointer.	trap->Cvar_Set ( "ui_about_mapname", mapname );	Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );	Com_sprintf( cgs.rawmapname, sizeof( cgs.rawmapname ), "maps/%s", mapname );//	Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) );//	trap->Cvar_Set("g_redTeam", cgs.redTeam);//	Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) );//	trap->Cvar_Set("g_blueTeam", cgs.blueTeam);	trap->Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) );	trap->Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) );	trap->Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) );	trap->Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) );	trap->Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) );	trap->Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) );	trap->Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) );	trap->Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) );	trap->Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) );	trap->Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) );	//Set the siege teams based on what the server has for overrides.	trap->Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1"));	trap->Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2"));	Q_strncpyz( cgs.voteString, CG_ConfigString( CS_VOTE_STRING ), sizeof( cgs.voteString ) );	// synchronise our expected snaps/sec with the server's framerate	i = atoi( Info_ValueForKey( info, "sv_fps" ) );	if ( i )		trap->Cvar_Set( "snaps", va( "%i", i ) );}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:98,


示例17: WM_ScoreboardOverlay

/*=======================================================================================================================================WM_ScoreboardOverlay=======================================================================================================================================*/int WM_ScoreboardOverlay(int x, int y, float fade) {	vec4_t hcolor;	int width;	char *s; // JPW NERVE	int msec, mins, seconds, tens; // JPW NERVE	width = INFO_PLAYER_WIDTH + INFO_LATENCY_WIDTH + INFO_SCORE_WIDTH + 25;	VectorSet(hcolor, 0, 0, 0);	hcolor[3] = 0.7 * fade;	// draw background	CG_FillRect(x - 12, y, width, 400, hcolor);	// draw title frame	VectorSet(hcolor, 0.0039, 0.0039, 0.2461);	hcolor[3] = 1 * fade;	CG_FillRect(x - 12, y, width, 30, hcolor);	CG_DrawRect(x - 12, y, width, 400, 2, hcolor);	if (cg.snap->ps.pm_type == PM_INTERMISSION) {		const char *s, *buf;		s = CG_ConfigString(CS_MULTI_INFO);		buf = Info_ValueForKey(s, "winner");		if (atoi(buf)) {			CG_DrawSmallString(x - 12 + 5, y, "ALLIES WIN!", fade);		} else {			CG_DrawSmallString(x - 12 + 5, y, "AXIS WIN!", fade);		}	}// mission time & reinforce time	else {		msec = (cgs.timelimit * 60.f * 1000.f) - (cg.time - cgs.levelStartTime);		seconds = msec / 1000;		mins = seconds / 60;		seconds -= mins * 60;		tens = seconds / 10;		seconds -= tens * 10;		s = va("Mission time:   %2.0f:%i%i", (float)mins, tens, seconds); // float cast to line up with reinforce time		CG_DrawSmallString(x - 7, y, s, fade);		if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_RED) {			msec = cg_redlimbotime.integer - (cg.time % cg_redlimbotime.integer);		} else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_BLUE) {			msec = cg_bluelimbotime.integer - (cg.time % cg_bluelimbotime.integer);		} else { // no team(spectator mode)			msec = 0;		}		if (msec) {			seconds = msec / 1000;			mins = seconds / 60;			seconds -= mins * 60;			tens = seconds / 10;			seconds -= tens * 10;			s = va("Reinforce time: %2.0f:%i%i", (float)mins, tens, seconds);			CG_DrawSmallString(x - 7, y + 16, s, fade);		}	}// 	CG_DrawSmallString(x - 12 + 5, y, "Wolfenstein Multiplayer", fade); // old one	y = WM_DrawObjectives(x, y, width, fade);	y += 5;	// draw field names	CG_DrawSmallString(x, y, "Players", fade);	x += INFO_PLAYER_WIDTH;	CG_DrawSmallString(x, y, "Score", fade);	x += INFO_SCORE_WIDTH;	CG_DrawSmallString(x, y, "Latency", fade);	y += 20;	return y;}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:84,


示例18: CG_DrawConnectScreen

void CG_DrawConnectScreen(qboolean interactive, qboolean forcerefresh){	static qboolean inside = qfalse;	char            buffer[1024];	bg_loadscreeninteractive = interactive;	if (!DC)	{		return;	}	if (inside)	{		return;	}	inside = qtrue;	if (!bg_loadscreeninited)	{		trap_Cvar_Set("ui_connecting", "0");		DC->registerFont("ariblk", 27, &bg_loadscreenfont1);		DC->registerFont("courbd", 30, &bg_loadscreenfont2);		bg_axispin = DC->registerShaderNoMip("gfx/loading/pin_axis");		bg_alliedpin = DC->registerShaderNoMip("gfx/loading/pin_allied");		bg_neutralpin = DC->registerShaderNoMip("gfx/loading/pin_neutral");		bg_pin = DC->registerShaderNoMip("gfx/loading/pin_shot");		bg_filter_pb = DC->registerShaderNoMip("ui/assets/filter_pb");		bg_filter_ff = DC->registerShaderNoMip("ui/assets/filter_ff");		bg_filter_hw = DC->registerShaderNoMip("ui/assets/filter_weap");		bg_filter_lv = DC->registerShaderNoMip("ui/assets/filter_lives");		bg_filter_al = DC->registerShaderNoMip("ui/assets/filter_antilag");		bg_filter_bt = DC->registerShaderNoMip("ui/assets/filter_balance");		bg_mappic = 0;		BG_PanelButtonsSetup(loadpanelButtons);		bg_loadscreeninited = qtrue;	}	BG_PanelButtonsRender(loadpanelButtons);	if (interactive)	{		DC->drawHandlePic(DC->cursorx, DC->cursory, 32, 32, DC->Assets.cursor);	}	DC->getConfigString(CS_SERVERINFO, buffer, sizeof(buffer));	if (*buffer)	{		const char     *str;		qboolean        enabled = qfalse;		float           x, y;		int             i;//      vec4_t clr1 = { 41/255.f,   51/255.f,   43/255.f,   204/255.f };//      vec4_t clr2 = { 0.f,        0.f,        0.f,        225/255.f };		vec4_t          clr3 = { 1.f, 1.f, 1.f, .6f };		/*		CG_FillRect( 8, 8, 230, 16, clr1 );				CG_DrawRect_FixedBorder( 8, 8, 230, 16, 1, colorMdGrey );				CG_FillRect( 8, 23, 230, 210, clr2 );				CG_DrawRect_FixedBorder( 8, 23, 230, 216, 1, colorMdGrey );*/		y = 322;		CG_Text_Paint_Centred_Ext(540, y, 0.22f, 0.22f, clr3, "SERVER INFO", 0, 0, 0, &bg_loadscreenfont1);		y = 340;		str = Info_ValueForKey(buffer, "sv_hostname");		CG_Text_Paint_Centred_Ext(540, y, 0.2f, 0.2f, colorWhite, str && *str ? str : "ETHost", 0, 26, 0, &bg_loadscreenfont2);		y += 14;		for (i = 0; i < MAX_MOTDLINES; i++)		{			str = CG_ConfigString(CS_CUSTMOTD + i);			if (!str || !*str)			{				break;			}			CG_Text_Paint_Centred_Ext(540, y, 0.2f, 0.2f, colorWhite, str, 0, 26, 0, &bg_loadscreenfont2);			y += 10;		}		y = 417;		str = Info_ValueForKey(buffer, "g_friendlyfire");//.........这里部分代码省略.........
开发者ID:morsik,项目名称:warpig,代码行数:101,


示例19: CG_ParseServerinfo

/*================CG_ParseServerinfoThis is called explicitly when the gamestate is first received,and whenever the server updates any serverinfo flagged cvars================*/void CG_ParseServerinfo( void ) {	const char	*info;	char	*mapname;	int		i;	info = CG_ConfigString( CS_SERVERINFO );	cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap->Cvar_GetHiddenVarValue("g_iknowkungfu");	cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) );	cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) );	//trap->Cvar_Set("bg_fighterAltControl", Info_ValueForKey( info, "bg_fighterAltControl" ));	cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) );	cgs.gametype = (gametype_t)atoi( Info_ValueForKey( info, "g_gametype" ) );	trap->Cvar_Set("g_gametype", va("%i", cgs.gametype));	cgs.needpass = atoi( Info_ValueForKey( info, "needpass" ) );	cgs.wDisable = atoi( Info_ValueForKey( info, "wdisable" ) );	cgs.fDisable = atoi( Info_ValueForKey( info, "fdisable" ) );	cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) );	cgs.teamflags = atoi( Info_ValueForKey( info, "teamflags" ) );	cgs.fraglimit = atoi( Info_ValueForKey( info, "fraglimit" ) );	cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) );	cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) );	cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) );	cgs.maxclients = atoi( Info_ValueForKey( info, "sv_maxclients" ) );	mapname = Info_ValueForKey( info, "mapname" );	//rww - You must do this one here, Info_ValueForKey always uses the same memory pointer.	trap->Cvar_Set ( "ui_about_mapname", mapname );	Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );	Com_sprintf( cgs.rawmapname, sizeof( cgs.rawmapname ), "%s", mapname );//	Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) );//	trap->Cvar_Set("g_redTeam", cgs.redTeam);//	Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) );//	trap->Cvar_Set("g_blueTeam", cgs.blueTeam);	trap->Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) );	trap->Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) );	trap->Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) );	trap->Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) );	trap->Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) );	trap->Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) );	trap->Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) );	trap->Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) );	trap->Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) );	trap->Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) );	//Set the siege teams based on what the server has for overrides.	trap->Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1"));	trap->Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2"));	//Raz: Fix bogus vote strings	Q_strncpyz( cgs.voteString, CG_ConfigString( CS_VOTE_STRING ), sizeof( cgs.voteString ) );	//Raz: Synchronise our expected snaps/sec with the server's framerate	//		OpenJK servers will try to match us to the sv_fps too (sv_client.cpp -> SV_UserinfoChanged)	i = atoi( Info_ValueForKey( info, "sv_fps" ) );	if ( i )		trap->Cvar_Set( "snaps", va( "%i", i ) );}
开发者ID:JKGDevs,项目名称:JediKnightGalaxies,代码行数:72,


示例20: CG_LoadPanel_RenderCampaignPins

void CG_LoadPanel_RenderCampaignPins(panel_button_t *button){	int             i;	qhandle_t       shader;	/*char buffer[1024];	   char *s;	   int gametype;	   DC->getConfigString( CS_SERVERINFO, buffer, sizeof( buffer ) );	   s = Info_ValueForKey( buffer, "g_gametype" );	   gametype = atoi(s); */	if (cgs.gametype == GT_WOLF_STOPWATCH || cgs.gametype == GT_WOLF_LMS || cgs.gametype == GT_WOLF)	{		float           px, py;		if (!cgs.arenaInfoLoaded)		{			return;		}		px = (cgs.arenaData.mappos[0] / 1024.f) * 440.f;		py = (cgs.arenaData.mappos[1] / 1024.f) * 480.f;		CG_LoadPanel_DrawPin(cgs.arenaData.longname, px, py, 0.22f, 0.25f, bg_neutralpin, 16.f, 16.f);	}	else	{		if (!cgs.campaignInfoLoaded)		{			return;		}		for (i = 0; i < cgs.campaignData.mapCount; i++)		{			float           px, py;			cg.teamWonRounds[1] = atoi(CG_ConfigString(CS_ROUNDSCORES1));			cg.teamWonRounds[0] = atoi(CG_ConfigString(CS_ROUNDSCORES2));			if (cg.teamWonRounds[1] & (1 << i))			{				shader = bg_axispin;			}			else if (cg.teamWonRounds[0] & (1 << i))			{				shader = bg_alliedpin;			}			else			{				shader = bg_neutralpin;			}			px = (cgs.campaignData.arenas[i].mappos[0] / 1024.f) * 440.f;			py = (cgs.campaignData.arenas[i].mappos[1] / 1024.f) * 480.f;			CG_LoadPanel_DrawPin(cgs.campaignData.arenas[i].longname, px, py, 0.22f, 0.25f, shader, 16.f, 16.f);		}	}}
开发者ID:morsik,项目名称:warpig,代码行数:61,


示例21: CG_ConfigStringModified

static void CG_ConfigStringModified( void ) {	const char	*str;	int		num;	num = atoi( CG_Argv( 1 ) );	// get the gamestate from the client system, which will have the	// new configstring already integrated	trap->GetGameState( &cgs.gameState );	// look up the individual string that was modified	str = CG_ConfigString( num );	// do something with it if necessary	if ( num == CS_MUSIC ) {		CG_StartMusic( qtrue );	} else if ( num == CS_SERVERINFO ) {		CG_ParseServerinfo();	} else if ( num == CS_WARMUP ) {		CG_ParseWarmup();	} else if ( num == CS_SCORES1 ) {		cgs.scores1 = atoi( str );	} else if ( num == CS_SCORES2 ) {		cgs.scores2 = atoi( str );	}	else if ( num == CS_CLIENT_DUELWINNER )	{		cgs.duelWinner = atoi ( str );	}	else if ( num == CS_CLIENT_DUELISTS )	{		char buf[64];		int c = 0;		int i = 0;		while (str[i] && str[i] != '|')		{			buf[c] = str[i];			c++;			i++;		}		buf[c] = 0;		cgs.duelist1 = atoi ( buf );		c = 0;		i++;		while (str[i] && str[i] != '|')		{			buf[c] = str[i];			c++;			i++;		}		buf[c] = 0;		cgs.duelist2 = atoi ( buf );		if (str[i])		{			c = 0;			i++;			while (str[i])			{				buf[c] = str[i];				c++;				i++;			}			buf[c] = 0;			cgs.duelist3 = atoi(buf);		}	}	else if ( num == CS_CLIENT_DUELHEALTHS ) {	// nmckenzie: DUEL_HEALTH		SetDuelistHealthsFromConfigString(str);	}	else if ( num == CS_LEVEL_START_TIME ) {		cgs.levelStartTime = atoi( str );	} else if ( num == CS_VOTE_TIME ) {		cgs.voteTime = atoi( str );		cgs.voteModified = qtrue;	} else if ( num == CS_VOTE_YES ) {		cgs.voteYes = atoi( str );		cgs.voteModified = qtrue;	} else if ( num == CS_VOTE_NO ) {		cgs.voteNo = atoi( str );		cgs.voteModified = qtrue;	} else if ( num == CS_VOTE_STRING ) {		Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) );	} else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) {		cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str );		cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue;	} else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) {		cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str );		cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue;	} else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) {		cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str );		cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue;	} else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) {		Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) );//.........这里部分代码省略.........
开发者ID:JKGDevs,项目名称:JediKnightGalaxies,代码行数:101,


示例22: CG_Init

/*=================CG_InitCalled after every level change or subsystem restartWill perform callbacks to make the loading info screen update.=================*/void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {	const char	*s;	// clear everything	memset( &cgs, 0, sizeof( cgs ) );	memset( &cg, 0, sizeof( cg ) );	memset( cg_entities, 0, sizeof(cg_entities) );	memset( cg_weapons, 0, sizeof(cg_weapons) );	memset( cg_items, 0, sizeof(cg_items) );	cg.clientNum = clientNum;	cgs.processedSnapshotNum = serverMessageNum;	cgs.serverCommandSequence = serverCommandSequence;	// load a few needed things before we do any screen updates	cgs.media.charsetShader		= trap_R_RegisterShader( "gfx/2d/bigchars" );	cgs.media.whiteShader		= trap_R_RegisterShader( "white" );	cgs.media.charsetProp		= trap_R_RegisterShaderNoMip( "menu/art/font1_prop.tga" );	cgs.media.charsetPropGlow	= trap_R_RegisterShaderNoMip( "menu/art/font1_prop_glo.tga" );	cgs.media.charsetPropB		= trap_R_RegisterShaderNoMip( "menu/art/font2_prop.tga" );	CG_RegisterCvars();	CG_InitConsoleCommands();	cg.weaponSelect = WP_MACHINEGUN;	cgs.redflag = cgs.blueflag = -1; // For compatibily, default to unset for	cgs.flagStatus = -1;	// old servers	// get the rendering configuration from the client system	trap_GetGlconfig( &cgs.glconfig );	cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;	cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;	// get the gamestate from the client system	trap_GetGameState( &cgs.gameState );	// check version	s = CG_ConfigString( CS_GAME_VERSION );	if ( strcmp( s, GAME_VERSION ) ) {		CG_Error( "Client/Server game mismatch: %s/%s", GAME_VERSION, s );	}	s = CG_ConfigString( CS_LEVEL_START_TIME );	cgs.levelStartTime = atoi( s );	CG_ParseServerinfo();	// load the new map	CG_LoadingString( "collision map" );	trap_CM_LoadMap( cgs.mapname );	cg.loading = qtrue;		// force players to load instead of defer	CG_LoadingString( "sounds" );	CG_RegisterSounds();	CG_LoadingString( "graphics" );	CG_RegisterGraphics();	CG_LoadingString( "clients" );	CG_RegisterClients();		// if low on memory, some clients will be deferred	cg.loading = qfalse;	// future players will be deferred	CG_InitLocalEntities();	CG_InitMarkPolys();	// remove the last loading update	cg.infoScreenText[0] = 0;	// Make sure we have update values (scores)	CG_SetConfigValues();	CG_StartMusic();	CG_LoadingString( "" );	CG_ShaderStateChanged();	trap_S_ClearLoopingSounds( qtrue );}
开发者ID:wombat23,项目名称:omoh2,代码行数:98,


示例23: CG_ParseFireteams

// Parses fireteam servercommandvoid CG_ParseFireteams(){	int        i, j;	char       *s;	const char *p;	int        clnts[2];	qboolean onFireteam2;	qboolean isLeader2;//	qboolean onFireteam =	CG_IsOnFireteam( cg.clientNum ) ? qtrue : qfalse;//	qboolean isLeader =		CG_IsFireTeamLeader( cg.clientNum ) ? qtrue : qfalse;	for (i = 0; i < MAX_CLIENTS; i++)	{		cgs.clientinfo[i].fireteamData = NULL;	}	for (i = 0; i < MAX_FIRETEAMS; i++)	{		char hexbuffer[11] = "0x00000000";		p = CG_ConfigString(CS_FIRETEAMS + i);/*		s = Info_ValueForKey(p, "n");        if(!s || !*s) {            cg.fireTeams[i].inuse = qfalse;            continue;        } else {            cg.fireTeams[i].inuse = qtrue;        }*///		Q_strncpyz(cg.fireTeams[i].name, s, 32);//		CG_Printf("Fireteam: %s/n", cg.fireTeams[i].name);		j = atoi(Info_ValueForKey(p, "id"));		if (j == -1)		{			cg.fireTeams[i].inuse = qfalse;			continue;		}		else		{			cg.fireTeams[i].inuse = qtrue;			cg.fireTeams[i].ident = j;		}		s                      = Info_ValueForKey(p, "l");		cg.fireTeams[i].leader = atoi(s);		s = Info_ValueForKey(p, "c");		Q_strncpyz(hexbuffer + 2, s, 9);		sscanf(hexbuffer, "%x", &clnts[1]);		Q_strncpyz(hexbuffer + 2, s + 8, 9);		sscanf(hexbuffer, "%x", &clnts[0]);		for (j = 0; j < MAX_CLIENTS; j++)		{			if (COM_BitCheck(clnts, j))			{				cg.fireTeams[i].joinOrder[j]   = qtrue;				cgs.clientinfo[j].fireteamData = &cg.fireTeams[i];//				CG_Printf("%s/n", cgs.clientinfo[j].name);			}			else			{				cg.fireTeams[i].joinOrder[j] = qfalse;			}		}	}	CG_SortClientFireteam();	onFireteam2 = CG_IsOnFireteam(cg.clientNum) ? qtrue : qfalse;	isLeader2   = CG_IsFireTeamLeader(cg.clientNum) ? qtrue : qfalse;}
开发者ID:morsik,项目名称:war-territory,代码行数:76,


示例24: CG_ParseServerinfo

/*================CG_ParseServerinfoThis is called explicitly when the gamestate is first received,and whenever the server updates any serverinfo flagged cvars================*/void CG_ParseServerinfo( void ) {	const char	*info;	char	*mapname;	info = CG_ConfigString( CS_SERVERINFO );	cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) );	cgs.teamflags = atoi( Info_ValueForKey( info, "teamflags" ) );	cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) );	cgs.maxclients = 1;	mapname = Info_ValueForKey( info, "mapname" );	Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );	char *p = strrchr(mapname,'/');	strcpy( cgs.stripLevelName[0], p?p+1:mapname );	strupr( cgs.stripLevelName[0] );	for (int i=1; i<STRIPED_LEVELNAME_VARIATIONS; i++)	// clear retry-array	{		cgs.stripLevelName[i][0]='/0';	}	// be careful with the []-numbers here. Currently I use 0,1,2 for replacements or substitution, and [3] for "INGAME"	//	I know, if I'd known there was going to be this much messing about I'd have subroutinised it all and done it	//	neater, but it kinda evolved...   Feel free to bug me if you want to add to it... ?  -Ste.	////FIXME: a better way to handle sound-matched strings from other levels (currently uses levelname+sound as key)	// additional String files needed for some levels...	//	// JKA...	if (!stricmp(cgs.stripLevelName[0],"YAVIN1B"))	{		strcpy( cgs.stripLevelName[1], "YAVIN1");	}/*	// JK2...	if (!stricmp(cgs.stripLevelName[0],"KEJIM_BASE") ||		!stricmp(cgs.stripLevelName[0],"KEJIM_POST")		)	{		strcpy( cgs.stripLevelName[1], "ARTUS_MINE" );	}	if (!stricmp(cgs.stripLevelName[0],"DOOM_DETENTION") ||		!stricmp(cgs.stripLevelName[0],"DOOM_SHIELDS")		)	{		strcpy( cgs.stripLevelName[1], "DOOM_COMM" );	}	if (!stricmp(cgs.stripLevelName[0],"DOOM_COMM"))	{		strcpy( cgs.stripLevelName[1], "CAIRN_BAY" );	}	if (!stricmp(cgs.stripLevelName[0],"NS_STARPAD"))	{		strcpy( cgs.stripLevelName[1], "ARTUS_TOPSIDE" );	// for dream sequence...		strcpy( cgs.stripLevelName[2], "BESPIN_UNDERCITY" );	// for dream sequence...	}	if (!stricmp(cgs.stripLevelName[0],"BESPIN_PLATFORM"))	{		strcpy( cgs.stripLevelName[1], "BESPIN_UNDERCITY" );	}*/}
开发者ID:Camron,项目名称:OpenJK,代码行数:70,


示例25: CG_NewParticleArea

/** * @brief CG_NewParticleArea * @param[in] num * @return * * @note Unused */int CG_NewParticleArea(int num){	char   *str;	char   *token;	int    type;	vec3_t origin, origin2;	int    i;	float  range;	int    turb;	int    numparticles;	int    snum;	str = (char *) CG_ConfigString(num);	if (!str[0])	{		return (0);	}	// returns type 128 64 or 32	token = COM_Parse(&str);	type  = atoi(token);	switch (type)	{	case 0:		range = 256;		break;	case 1:		range = 128;		break;	case 2:	case 7:		range = 64;		break;	case 3:	case 6:		range = 32;		break;	case 4:		range = 8;		break;	case 5:		range = 16;		break;	default:		range = 0;		break;	}	for (i = 0; i < 3; i++)	{		token     = COM_Parse(&str);		origin[i] = (float)atof(token);	}	for (i = 0; i < 3; i++)	{		token      = COM_Parse(&str);		origin2[i] = (float)atof(token);	}	token        = COM_Parse(&str);	numparticles = atoi(token);	token = COM_Parse(&str);	turb  = atoi(token);	token = COM_Parse(&str);	snum  = atoi(token);	for (i = 0; i < numparticles; i++)	{		if (type >= 4)		{			CG_ParticleBubble(cgs.media.waterBubbleShader, origin, origin2, turb, range, snum);		}		else		{			CG_ParticleSnow(cgs.media.snowShader, origin, origin2, turb, range, snum);		}	}	return 1;}
开发者ID:etlegacy,项目名称:etlegacy,代码行数:91,


示例26: CG_EntityEvent

//.........这里部分代码省略.........				VectorMA(es->origin2, 4, cg.refdef.viewaxis[1], es->origin2);		}		CG_RailTrail(ci, es->origin2, es->pos.trBase);		// if the end was on a nomark surface, don't make an explosion		if ( es->eventParm != 255 ) {			ByteToDir( es->eventParm, dir );			CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT );		}		break;	case EV_BULLET_HIT_WALL:		DEBUGNAME("EV_BULLET_HIT_WALL");		ByteToDir( es->eventParm, dir );		CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD );		break;	case EV_BULLET_HIT_FLESH:		DEBUGNAME("EV_BULLET_HIT_FLESH");		CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm );		break;	case EV_SHOTGUN:		DEBUGNAME("EV_SHOTGUN");		CG_ShotgunFire( es );		break;	case EV_GENERAL_SOUND:		DEBUGNAME("EV_GENERAL_SOUND");		if ( cgs.gameSounds[ es->eventParm ] ) {			trap_S_StartSound (NULL, es->number, CHAN_VOICE, cgs.gameSounds[ es->eventParm ] );		} else {			s = CG_ConfigString( CS_SOUNDS + es->eventParm );			trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, s ) );		}		break;	case EV_GLOBAL_SOUND:	// play from the player's head so it never diminishes		DEBUGNAME("EV_GLOBAL_SOUND");		if ( cgs.gameSounds[ es->eventParm ] ) {			trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.gameSounds[ es->eventParm ] );		} else {			s = CG_ConfigString( CS_SOUNDS + es->eventParm );			trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, CG_CustomSound( es->number, s ) );		}		break;	case EV_GLOBAL_TEAM_SOUND:	// play from the player's head so it never diminishes		{			DEBUGNAME("EV_GLOBAL_TEAM_SOUND");			switch( es->eventParm ) {				case GTS_RED_CAPTURE: // CTF: red team captured the blue flag, 1FCTF: red team captured the neutral flag					if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED )						CG_AddBufferedSound( cgs.media.captureYourTeamSound );					else						CG_AddBufferedSound( cgs.media.captureOpponentSound );					break;				case GTS_BLUE_CAPTURE: // CTF: blue team captured the red flag, 1FCTF: blue team captured the neutral flag					if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE )						CG_AddBufferedSound( cgs.media.captureYourTeamSound );					else						CG_AddBufferedSound( cgs.media.captureOpponentSound );					break;				case GTS_RED_RETURN: // CTF: blue flag returned, 1FCTF: never used					if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED )
开发者ID:donald-hanson,项目名称:battle-of-the-sexes,代码行数:67,


示例27: CG_InitConsoleCommands

/** * @brief Let the client system know about all of our commands so it can perform tab * completion */void CG_InitConsoleCommands(void){	int        i;	const char *s;	for (i = 0 ; i < sizeof(commands) / sizeof(commands[0]) ; i++)	{		trap_AddCommand(commands[i].cmd);	}	// the game server will interpret these commands, which will be automatically	// forwarded to the server after they are not recognized locally	trap_AddCommand("kill");	trap_AddCommand("say");	trap_AddCommand("give");	trap_AddCommand("god");	trap_AddCommand("notarget");	trap_AddCommand("noclip");	trap_AddCommand("team");	trap_AddCommand("follow");	trap_AddCommand("setviewpos");	trap_AddCommand("callvote");	trap_AddCommand("vote");	trap_AddCommand("nofatigue");	trap_AddCommand("follownext");	trap_AddCommand("followprev");	trap_AddCommand("start_match");	trap_AddCommand("reset_match");	trap_AddCommand("swap_teams");	trap_AddCommand("?");	trap_AddCommand("bottomshots");	trap_AddCommand("commands");	trap_AddCommand("lock");#ifdef FEATURE_MULTIVIEW	trap_AddCommand("mvadd");	trap_AddCommand("mvaxis");	trap_AddCommand("mvallies");	trap_AddCommand("mvall");	trap_AddCommand("mvnone");#endif	trap_AddCommand("notready");	trap_AddCommand("pause");	trap_AddCommand("players");	trap_AddCommand("readyteam");	trap_AddCommand("ready");	trap_AddCommand("ref");	trap_AddCommand("say_teamnl");	trap_AddCommand("say_team");	trap_AddCommand("scores");	trap_AddCommand("specinvite");	trap_AddCommand("speclock");	trap_AddCommand("specunlock");	trap_AddCommand("statsall");	trap_AddCommand("statsdump");	trap_AddCommand("timein");	trap_AddCommand("timeout");	trap_AddCommand("topshots");	trap_AddCommand("unlock");	trap_AddCommand("unpause");	trap_AddCommand("unready");	trap_AddCommand("weaponstats");	trap_AddCommand("fireteam");	trap_AddCommand("showstats");	trap_AddCommand("ignore");	trap_AddCommand("unignore");	trap_AddCommand("campaign");	trap_AddCommand("listcampaigns");	trap_AddCommand("imready");	trap_AddCommand("say_buddy");	trap_AddCommand("setspawnpt");	trap_AddCommand("vsay");	trap_AddCommand("vsay_buddy");	trap_AddCommand("vsay_team");	trap_AddCommand("where");#ifdef FEATURE_LUA	trap_AddCommand("lua_status");#endif	// remove engine commands to avoid abuse	trap_RemoveCommand("+lookup");	trap_RemoveCommand("-lookup");	trap_RemoveCommand("+lookdown");	trap_RemoveCommand("-lookdown");	// only allow configstrings command when cheats enabled	s = Info_ValueForKey(CG_ConfigString(CS_SYSTEMINFO),	                     "sv_cheats");	if (s[0] != '1')//.........这里部分代码省略.........
开发者ID:ic319,项目名称:etlegacy,代码行数:101,


示例28: CG_ParseServerinfo

void CG_ParseServerinfo( void ) {	const char *info = NULL, *tinfo = NULL;	char *mapname;	int i;	info = CG_ConfigString( CS_SERVERINFO );	cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap->Cvar_GetHiddenVarValue("g_iknowkungfu");	cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) );	cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) );	trap->Cvar_Set("bg_fighterAltControl", Info_ValueForKey( info, "bg_fighterAltControl" ));	cgs.siegeTeamSwitch = atoi( Info_ValueForKey( info, "g_siegeTeamSwitch" ) );	cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) );	cgs.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );	trap->Cvar_Set("g_gametype", va("%i", cgs.gametype));	cgs.needpass = atoi( Info_ValueForKey( info, "needpass" ) );	cgs.jediVmerc = atoi( Info_ValueForKey( info, "g_jediVmerc" ) );	cgs.wDisable = atoi( Info_ValueForKey( info, "wdisable" ) );	cgs.fDisable = atoi( Info_ValueForKey( info, "fdisable" ) );	cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) );	cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) );	cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) );	// reset fraglimit warnings	i = atoi( Info_ValueForKey( info, "fraglimit" ) );	if ( cgs.fraglimit < i )		cg.fraglimitWarnings &= ~(1|2|4);	cgs.fraglimit = i;	// reset timelimit warnings	i = atoi( Info_ValueForKey( info, "timelimit" ) );	if ( cgs.timelimit != i )		cg.timelimitWarnings &= ~(1|2);	cgs.timelimit = i;	cgs.maxclients = Com_Clampi( 0, MAX_CLIENTS, atoi( Info_ValueForKey( info, "sv_maxclients" ) ) );	cgs.japp.jp_cinfo = atoi( Info_ValueForKey( info, "jp_cinfo" ) );	cgs.japp.overbounce = atoi( Info_ValueForKey( info, "pmove_overbounce" ) );		//Raz: Server support flags	tinfo = Info_ValueForKey( info, "ssf" );	if ( !Q_stricmpn( Info_ValueForKey( info, "gamename" ), "JA+ Mod", 7 ) )		cg.japp.SSF = JAPLUS_SERVER_FLAGS;#if MAC_PORT	if ( tinfo[0] && sscanf( tinfo, "%X", &cg.japp.SSF ) != 1 )#else	if ( tinfo[0] && sscanf_s( tinfo, "%X", &cg.japp.SSF ) != 1 )#endif		CG_SecurityLogPrintf( "CG_ParseServerinfo: serverinfo 'ssf' was found, but invalid./n"  );	Com_Printf( "Server support hints: 0x%X/n", cg.japp.SSF );	mapname = Info_ValueForKey( info, "mapname" );	//rww - You must do this one here, Info_ValueForKey always uses the same memory pointer.	trap->Cvar_Set ( "ui_about_mapname", mapname );	Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );//	Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) );//	trap->Cvar_Set("g_redTeam", cgs.redTeam);//	Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) );//	trap->Cvar_Set("g_blueTeam", cgs.blueTeam);	trap->Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) );	trap->Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) );	trap->Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) );	trap->Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) );	trap->Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) );	trap->Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) );	trap->Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) );	trap->Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) );	trap->Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) );	trap->Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) );	//Set the siege teams based on what the server has for overrides.	trap->Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1"));	trap->Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2"));	tinfo = CG_ConfigString( CS_TERRAINS + 1 );	if ( !tinfo || !*tinfo )	{		cg.mInRMG = qfalse;	}	else	{		int weather = 0;		cg.mInRMG = qtrue;		trap->Cvar_Set("RMG", "1");		weather = atoi( Info_ValueForKey( info, "RMG_weather" ) );		trap->Cvar_Set("RMG_weather", va("%i", weather));//.........这里部分代码省略.........
开发者ID:Geptun,项目名称:japp,代码行数:101,


示例29: switch

const char *CG_GetPMItemText(centity_t *cent){	switch (cent->currentState.effect1Time)	{	case PM_DYNAMITE:		switch (cent->currentState.effect2Time)		{		case 0:			return va(CG_TranslateString("Planted at %s."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time));		case 1:			return va(CG_TranslateString("Defused at %s."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time));		}		break;	case PM_CONSTRUCTION:		switch (cent->currentState.effect2Time)		{		case -1:			return CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time);		case 0:			return va(CG_TranslateString("%s has been constructed."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time));		}		break;	case PM_DESTRUCTION:		switch (cent->currentState.effect2Time)		{		case 0:			return va(CG_TranslateString("%s has been damaged."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time));		case 1:			return va(CG_TranslateString("%s has been destroyed."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time));		}		break;	case PM_MINES:		// Prevent spectators from being informed when a mine is spotted		if (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR)		{			return NULL;		}		if (cgs.clientinfo[cg.clientNum].team == cent->currentState.effect2Time)		{			return NULL;		}		if (cg_locations.integer & LOC_LANDMINES)		{			char *locStr = CG_BuildLocationString(-1, cent->currentState.origin, LOC_LANDMINES);			if (!locStr || !*locStr)			{				return va("%sSpotted by ^7%s", TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name);			}			return va(CG_TranslateString("%sSpotted by ^7%s%s at %s"), TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name, TXTCOLOR_OBJ, locStr);		}		else		{			return va(CG_TranslateString("%sSpotted by ^7%s"), TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name);		}		break;	case PM_OBJECTIVE:		switch (cent->currentState.density)		{		case 0:			return va(CG_TranslateString("%s have stolen %s!"), cent->currentState.effect2Time == TEAM_ALLIES ? CG_TranslateString("Allies") : CG_TranslateString("Axis"), CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time));		case 1:			return va(CG_TranslateString("%s have returned %s!"), cent->currentState.effect2Time == TEAM_ALLIES ? CG_TranslateString("Allies") : CG_TranslateString("Axis"), CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time));		}		break;	case PM_TEAM:		switch (cent->currentState.density)		{		case 0:             // joined		{			const char *teamstr = NULL;			switch (cent->currentState.effect2Time)			{			case TEAM_AXIS:				teamstr = "Axis team";				break;			case TEAM_ALLIES:				teamstr = "Allied team";				break;			default:				teamstr = "Spectators";				break;			}			return va(CG_TranslateString("%s^7 has joined the %s^7!"), cgs.clientinfo[cent->currentState.effect3Time].name, CG_TranslateString(teamstr));		}		case 1:			return va(CG_TranslateString("%s^7 disconnected"), cgs.clientinfo[cent->currentState.effect3Time].name);		}		break;	}	return NULL;}
开发者ID:Mailaender,项目名称:etlegacy,代码行数:96,



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


C++ CG_CrosshairPlayer函数代码示例
C++ CG_CenterPrint函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。