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

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

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

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

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

示例1: G_ParseCampaigns

void G_ParseCampaigns(void){	int      i;	qboolean mapFound = qfalse;	level.campaignCount   = 0;	level.currentCampaign = -1;	memset(&g_campaigns, 0, sizeof(g_campaignInfo_t) * MAX_CAMPAIGNS);	if (g_gametype.integer != GT_WOLF_CAMPAIGN)	{		trap_Cvar_Set("g_oldCampaign", "");		trap_Cvar_Set("g_currentCampaign", "");		trap_Cvar_Set("g_currentCampaignMap", "0");		return;	}	if (g_campaignFile.string[0])	{		if (G_LoadCampaignsFromFile(g_campaignFile.string))		{			mapFound = qtrue;		}	}	if (!mapFound)	{		// get all campaigns from .campaign files		int  dirlen;		int  numdirs = trap_FS_GetFileList("scripts", ".campaign", bigTextBuffer, sizeof(bigTextBuffer));		char filename[MAX_QPATH]; // was 128		char *dirptr = bigTextBuffer;		for (i = 0; i < numdirs; i++, dirptr += dirlen + 1)		{			// log a warning if server has more than MAX_CAMPAIGNS			if (level.campaignCount >= MAX_CAMPAIGNS)			{				G_LogPrintf("WARNING G_ParseCampaigns: number of campaigns larger then MAX_CAMPAIGNS/n");				break;			}			dirlen = strlen(dirptr);			strcpy(filename, "scripts/");			strcat(filename, dirptr);			if (G_LoadCampaignsFromFile(filename))			{				mapFound = qtrue;			}		}	}	if (!mapFound)	{		// map isn't found in the current campaign, see if it's the first map in another campaign		for (i = 0; i < level.campaignCount; i++)		{			if (!Q_stricmp(g_campaigns[i].mapnames[0], level.rawmapname))			{				// someone manually specified a /map command, and it's the first map in a campaign				trap_Cvar_Set("g_currentCampaign", g_campaigns[i].shortname);				trap_Cvar_Set("g_currentCampaignMap", "0");				level.newCampaign = qtrue;				g_campaigns[level.campaignCount].current = 0;				level.currentCampaign                    = i;				break;			}		}		if (i == level.campaignCount)		{			char buf[MAX_STRING_CHARS];			if (trap_Argc() < 1) // command not found, throw error			{				G_Error("Usage 'map <mapname>/n'");			}			trap_Argv(0, buf, sizeof(buf));			if (!(*buf)) // command not found, throw error			{				G_Error("Usage 'map <mapname>/n'");			}			// no campaign found, fallback to GT_WOLF			// and reload the map			trap_Cvar_Set("g_gametype", "2");			trap_SendConsoleCommand(EXEC_APPEND, va("%s %s/n", buf, level.rawmapname));		}	}}
开发者ID:Mailaender,项目名称:etlegacy,代码行数:96,


示例2: value

/*QUAKED worldspawn (0 0 0) ? NO_GT_WOLF NO_GT_STOPWATCH NO_GT_CHECKPOINT NO_LMSEvery map should have exactly one worldspawn."music"     Music wav file"gravity"   800 is default gravity"message" Text to print during connection process"ambient"  Ambient light value (must use '_color')"_color"    Ambient light color (must be used with 'ambient')"sun"        Shader to use for 'sun' image*/void SP_worldspawn(void){	char           *s;	G_SpawnString("classname", "", &s);	if(Q_stricmp(s, "worldspawn"))	{		G_Error("SP_worldspawn: The first entity isn't 'worldspawn'");	}	// make some data visible to connecting client	trap_SetConfigstring(CS_GAME_VERSION, GAME_VERSION);	trap_SetConfigstring(CS_LEVEL_START_TIME, va("%i", level.startTime));	G_SpawnString("music", "", &s);	trap_SetConfigstring(CS_MUSIC, s);	G_SpawnString("message", "", &s);	trap_SetConfigstring(CS_MESSAGE, s);	// map specific message	G_SpawnString("cclayers", "0", &s);	if(atoi(s))	{		level.ccLayers = qtrue;	}	level.mapcoordsValid = qfalse;	if(G_SpawnVector2D("mapcoordsmins", "-128 128", level.mapcoordsMins) &&	// top left	   G_SpawnVector2D("mapcoordsmaxs", "128 -128", level.mapcoordsMaxs))	{							// bottom right		level.mapcoordsValid = qtrue;	}	BG_InitLocations(level.mapcoordsMins, level.mapcoordsMaxs);	trap_SetConfigstring(CS_MOTD, g_motd.string);	// message of the day	G_SpawnString("gravity", "800", &s);	trap_Cvar_Set("g_gravity", s);	G_SpawnString("spawnflags", "0", &s);	g_entities[ENTITYNUM_WORLD].spawnflags = atoi(s);	g_entities[ENTITYNUM_WORLD].r.worldflags = g_entities[ENTITYNUM_WORLD].spawnflags;	g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD;	g_entities[ENTITYNUM_WORLD].classname = "worldspawn";	// see if we want a warmup time	trap_SetConfigstring(CS_WARMUP, "");	if(g_restarted.integer)	{		trap_Cvar_Set("g_restarted", "0");		level.warmupTime = 0;	}	if(g_gamestate.integer == GS_PLAYING)	{		G_initMatch();	}}
开发者ID:ethr,项目名称:ETXreaLPro_etmain,代码行数:71,


示例3: EnumerateField

//.........这里部分代码省略.........		*(int *)pv = GetGEntityNum(*(gentity_t **)pv);		break;	case F_GROUP:		*(int *)pv = GetGroupNumber(*(AIGroupInfo_t **)pv);		break;	case F_GCLIENT:		*(int *)pv = GetGClientNum(*(gclient_t **)pv, (gentity_t *) pbBase);		break;	case F_ITEM:		*(int *)pv = GetGItemNum(*(gitem_t **)pv);		break;	case F_VEHINFO:		*(int *)pv = GetVehicleInfoNum(*(vehicleInfo_t **)pv);		break;	case F_BEHAVIORSET:		{			const char **p = (const char **) pv;			for (int i=0; i<NUM_BSETS; i++)			{				pv = &p[i];	// since you can't ++ a void ptr				*(int *)pv = GetStringNum(*(char **)pv);			}		}		break;/*MCG	case F_BODYQUEUE:		{			gentity_t **p = (gentity_t **) pv;			for (int i=0; i<BODY_QUEUE_SIZE; i++)			{				pv = &p[i];	// since you can't ++ a void ptr				*(int *)pv = GetGEntityNum(*(gentity_t **)pv);			}		}		break;*/	case F_ALERTEVENT:	// convert all gentity_t ptrs in an alertEvent array into indexes...		{			alertEvent_t* p = (alertEvent_t *) pv;			for (int i=0; i<MAX_ALERT_EVENTS; i++)			{				p[i].owner = (gentity_t *) GetGEntityNum(p[i].owner);			}		}		break;	case F_AIGROUPS:	// convert to ptrs within this into indexes...		{			AIGroupInfo_t* p = (AIGroupInfo_t *) pv;			for (int i=0; i<MAX_FRAME_GROUPS; i++)			{				p[i].enemy		= (gentity_t *) GetGEntityNum(p[i].enemy);				p[i].commander	= (gentity_t *) GetGEntityNum(p[i].commander);			}		}		break;	case F_ANIMFILESETS:		{			animFileSet_t* p = (animFileSet_t *) pv;			for (int i=0; i<MAX_ANIM_FILES; i++)			{				for ( int j=0; j<MAX_ANIM_EVENTS; j++ )				{					const char *ptAnimEventStringData = p[i].torsoAnimEvents[j].stringData;					*(int *)(&p[i].torsoAnimEvents[j].stringData) = GetStringNum( ptAnimEventStringData );					const char *plAnimEventStringData = p[i].legsAnimEvents[j].stringData;					*(int *)(&p[i].legsAnimEvents[j].stringData) = GetStringNum( plAnimEventStringData );				}			}		}		break;	case F_BOOLPTR:		*(qboolean *)pv = !!(*(int *)pv);		break;	// These are pointers that are always recreated	case F_NULL:		*(void **)pv = NULL;		break;	case F_IGNORE:		break;	default:		G_Error ("EnumerateField: unknown field type");		break;	}}
开发者ID:archSeer,项目名称:OpenJK,代码行数:101,


示例4: while

/*===========SelectNearestSpawnPointfor teleporting you back after falling into the void============*/gentity_t *SelectNearestSpawnPoint ( vec3_t Point, vec3_t origin, vec3_t angles ) {	gentity_t	*spot;	vec3_t	delta;	float		dist, nearestDist;	gentity_t	*nearestSpot;	nearestDist = 999999;	nearestSpot = NULL;	spot = NULL;	while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) {		VectorSubtract( spot->s.origin, Point, delta );		dist = VectorLength( delta );		if ( dist < nearestDist ) {			nearestDist = dist;			nearestSpot = spot;		}	}	while ((spot = G_Find (spot, FOFS(classname), "team_CTF_redplayer")) != NULL) {		VectorSubtract( spot->s.origin, Point, delta );		dist = VectorLength( delta );		if ( dist < nearestDist ) {			nearestDist = dist;			nearestSpot = spot;		}	}	while ((spot = G_Find (spot, FOFS(classname), "team_CTF_blueplayer")) != NULL) {		VectorSubtract( spot->s.origin, Point, delta );		dist = VectorLength( delta );		if ( dist < nearestDist ) {			nearestDist = dist;			nearestSpot = spot;		}	}	while ((spot = G_Find (spot, FOFS(classname), "team_CTF_redspawn")) != NULL) {		VectorSubtract( spot->s.origin, Point, delta );		dist = VectorLength( delta );		if ( dist < nearestDist ) {			nearestDist = dist;			nearestSpot = spot;		}	}	while ((spot = G_Find (spot, FOFS(classname), "team_CTF_bluespawn")) != NULL) {		VectorSubtract( spot->s.origin, Point, delta );		dist = VectorLength( delta );		if ( dist < nearestDist ) {			nearestDist = dist;			nearestSpot = spot;		}	}	// find a single player start spot	if (!nearestSpot) {		G_Error( "Couldn't find a spawn point" );	}	VectorCopy (nearestSpot->s.origin, origin);	origin[2] += 9;	VectorCopy (nearestSpot->s.angles, angles);	return nearestSpot;}
开发者ID:linux26,项目名称:corkscrew,代码行数:69,


示例5: G_RunFrame

//.........这里部分代码省略.........		if ( i == 0 )		{			// decay batteries if the goggles are active			if ( cg.zoomMode == 1 && ent->client->ps.batteryCharge > 0 )			{				ent->client->ps.batteryCharge--;			}			else if ( cg.zoomMode == 3 && ent->client->ps.batteryCharge > 0 )			{				ent->client->ps.batteryCharge -= 2;				if ( ent->client->ps.batteryCharge < 0 )				{					ent->client->ps.batteryCharge = 0;				}			}			G_CheckEndLevelTimers( ent );			//Recalculate the nearest waypoint for the coming NPC updates			NAV_FindPlayerWaypoint();			if( ent->taskManager && !stop_icarus )			{				ent->taskManager->Update();			}			//dead			if ( ent->health <= 0 )			{				if ( ent->client->ps.groundEntityNum != ENTITYNUM_NONE )				{//on the ground					pitch_roll_for_slope( ent, NULL );				}			}			continue;	// players are ucmd driven		}		G_RunThink( ent );	// be aware that ent may be free after returning from here, at least one func frees them		ClearNPCGlobals();			//	but these 2 funcs are ok		//UpdateTeamCounters( ent );	//	   to call anyway on a freed ent.	}	// perform final fixups on the player	ent = &g_entities[0];	if ( ent->inuse )	{		ClientEndFrame( ent );	}	if( g_numEntities->integer )	{		gi.Printf( S_COLOR_WHITE"Number of Entities in use : %d/n", ents_inuse );	}	//DEBUG STUFF	NAV_ShowDebugInfo();	NPC_ShowDebugInfo();	G_DynamicMusicUpdate();#if	AI_TIMERS	AITime -= navTime;	if ( AITime > 20 )	{		gi.Printf( S_COLOR_RED"ERROR: total AI time: %d/n", AITime );	}	else if ( AITime > 10 )	{		gi.Printf( S_COLOR_YELLOW"WARNING: total AI time: %d/n", AITime );	}	else if ( AITime > 2 )	{		gi.Printf( S_COLOR_GREEN"total AI time: %d/n", AITime );	}	if ( navTime > 20 )	{		gi.Printf( S_COLOR_RED"ERROR: total nav time: %d/n", navTime );	}	else if ( navTime > 10 )	{		gi.Printf( S_COLOR_YELLOW"WARNING: total nav time: %d/n", navTime );	}	else if ( navTime > 2 )	{		gi.Printf( S_COLOR_GREEN"total nav time: %d/n", navTime );	}#endif//	AI_TIMERS#ifndef FINAL_BUILD	if ( delayedShutDown != 0 && delayedShutDown < level.time )	{		G_Error( "Game Errors. Scroll up the console to read them." );	}#endif#ifdef _DEBUG	if(!(level.framenum&0xff))	{		ValidateInUseBits();	}#endif}
开发者ID:DustysPatch,项目名称:OpenJK,代码行数:101,


示例6: G_ScriptAction_FaceAngles

/*=================G_ScriptAction_FaceAngles  syntax: faceangles <pitch> <yaw> <roll> <duration/GOTOTIME> [ACCEL/DECCEL]  The entity will face the given angles, taking <duration> to get there. If the  GOTOTIME is given instead of a timed duration, the duration calculated from the  last gotomarker command will be used instead.=================*/qboolean G_ScriptAction_FaceAngles( gentity_t *ent, char *params ) {    char *pString, *token;    int duration, i;    vec3_t diff;    vec3_t angles;    int trType = TR_LINEAR_STOP;    if ( !params || !params[0] ) {        G_Error( "G_Scripting: syntax: faceangles <pitch> <yaw> <roll> <duration/GOTOTIME>/n" );    }    if ( ent->scriptStatus.scriptStackChangeTime == level.time ) {        pString = params;        for ( i = 0; i < 3; i++ ) {            token = COM_Parse( &pString );            if ( !token || !token[0] ) {                G_Error( "G_Scripting: syntax: faceangles <pitch> <yaw> <roll> <duration/GOTOTIME>/n" );            }            angles[i] = atoi( token );        }        token = COM_Parse( &pString );        if ( !token || !token[0] ) {            G_Error( "G_Scripting: faceangles requires a <pitch> <yaw> <roll> <duration/GOTOTIME>/n" );        }        if ( !Q_strcasecmp( token, "gototime" ) ) {            duration = ent->s.pos.trDuration;        } else {            duration = atoi( token );        }        token = COM_Parse( &pString );        if ( token && token[0] ) {            if ( !Q_strcasecmp( token, "accel" ) ) {                trType = TR_ACCELERATE;            }            if ( !Q_strcasecmp( token, "deccel" ) ) {                trType = TR_DECCELERATE;            }        }        for ( i = 0; i < 3; i++ ) {            diff[i] = AngleDifference( angles[i], ent->s.angles[i] );            while ( diff[i] > 180 )                diff[i] -= 360;            while ( diff[i] < -180 )                diff[i] += 360;        }        VectorCopy( ent->s.angles, ent->s.apos.trBase );        if ( duration ) {            VectorScale( diff, 1000.0 / (float)duration, ent->s.apos.trDelta );        } else {            VectorClear( ent->s.apos.trDelta );        }        ent->s.apos.trDuration = duration;        ent->s.apos.trTime = level.time;        ent->s.apos.trType = TR_LINEAR_STOP;        if ( trType != TR_LINEAR_STOP ) { // accel / deccel logic            // calc the speed from duration and start/end delta            for ( i = 0; i < 3; i++ ) {                ent->s.apos.trDelta[i] = 2.0 * 1000.0 * diff[i] / (float)duration;            }            ent->s.apos.trType = trType;        }    } else if ( ent->s.apos.trTime + ent->s.apos.trDuration <= level.time ) {        // finished turning        BG_EvaluateTrajectory( &ent->s.apos, ent->s.apos.trTime + ent->s.apos.trDuration, ent->s.angles );        VectorCopy( ent->s.angles, ent->s.apos.trBase );        VectorCopy( ent->s.angles, ent->r.currentAngles );        ent->s.apos.trTime = level.time;        ent->s.apos.trDuration = 0;        ent->s.apos.trType = TR_STATIONARY;        VectorClear( ent->s.apos.trDelta );        script_linkentity( ent );        return qtrue;    }    BG_EvaluateTrajectory( &ent->s.apos, level.time, ent->r.currentAngles );    script_linkentity( ent );    return qfalse;}
开发者ID:aleksandr-pushkarev,项目名称:RTCW-SP,代码行数:98,


示例7: misc_model_breakable_init

//initization for misc_model_breakablevoid misc_model_breakable_init( gentity_t *ent ){	int		type;	type = MDL_OTHER;	if (!ent->model) {		G_Error("no model set on %s at (%.1f %.1f %.1f)/n", ent->classname, ent->s.origin[0],ent->s.origin[1],ent->s.origin[2]);	}	//Main model	ent->s.modelindex = ent->sound2to1 = G_ModelIndex( ent->model );	if ( ent->spawnflags & 1 )	{//Blocks movement		ent->r.contents = CONTENTS_SOLID|CONTENTS_OPAQUE|CONTENTS_BODY|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;//Was CONTENTS_SOLID, but only architecture should be this		ent->s.solid = 2; //SOLID_BBOX		ent->clipmask = MASK_PLAYERSOLID;	}	else if ( ent->health )	{//Can only be shot		ent->r.contents = CONTENTS_SHOTCLIP;	}	if (type == MDL_OTHER)	{		ent->use = misc_model_use;		}	else if ( type == MDL_ARMOR_HEALTH )	{//		G_SoundIndex("sound/player/suithealth.wav");		ent->use = health_use;		if (!ent->count)		{			ent->count = 100;		}		ent->health = 60;	}	else if ( type == MDL_AMMO )	{//		G_SoundIndex("sound/player/suitenergy.wav");		//RAFIXME: add this use function		ent->use = ammo_use;		if (!ent->count)		{			ent->count = 100;		}		ent->health = 60;	}	if ( ent->health ) 	{		G_SoundIndex("sound/weapons/explosions/cargoexplode.wav");		ent->maxHealth = ent->health;		G_ScaleNetHealth(ent);		ent->takedamage = qtrue;		ent->pain = misc_model_breakable_pain;		//RACC - I think should be ->die		ent->die  = misc_model_breakable_die;		//ent->think  = misc_model_breakable_die;	}	ent->touch = misc_model_breakable_touch;}
开发者ID:ForcePush,项目名称:OJPRPFZ,代码行数:66,


示例8: SP_target_speaker

void SP_target_speaker( gentity_t *ent ) {	char	buffer[MAX_QPATH];	char	*s;	G_SpawnFloat( "wait", "0", &ent->wait );	G_SpawnFloat( "random", "0", &ent->random );	if ( !G_SpawnString( "noise", "NOSOUND", &s ) ) {		G_Error( "target_speaker without a noise key at %s", vtos( ent->s.origin ) );	}		// force all client reletive sounds to be "activator" speakers that	// play on the entity that activates it	if ( s[0] == '*' ) {		ent->spawnflags |= 8;	}	// Ridah, had to disable this so we can use sound scripts	// don't worry, if the script isn't found, it'll default back to	// .wav on the client-side	//if (!strstr( s, ".wav" )) {	//	Com_sprintf (buffer, sizeof(buffer), "%s.wav", s );	//} else {		Q_strncpyz( buffer, s, sizeof(buffer) );	//}	ent->noise_index = G_SoundIndex(buffer);	// a repeating speaker can be done completely client side	ent->s.eType = ET_SPEAKER;	ent->s.eventParm = ent->noise_index;	ent->s.frame = ent->wait * 10;	ent->s.clientNum = ent->random * 10;	// check for prestarted looping sound	if ( ent->spawnflags & 1 ) {		ent->s.loopSound = ent->noise_index;	}	ent->use = Use_Target_Speaker;	// GLOBAL	if (ent->spawnflags & (4|32)) {		ent->r.svFlags |= SVF_BROADCAST;	}	VectorCopy( ent->s.origin, ent->s.pos.trBase );	if (ent->spawnflags & 16)	{		ent->think = target_speaker_multiple;		ent->nextthink = level.time + 50;	}	// NO_PVS	if(ent->spawnflags & 32)		ent->s.density = 1;	else		ent->s.density = 0;	if(ent->radius)		ent->s.dmgFlags = ent->radius;	// store radius in dmgflags	else		ent->s.dmgFlags = 0;	// must link the entity so we get areas and clusters so	// the server can determine who to send updates to	trap_LinkEntity( ent );}
开发者ID:natelo,项目名称:rtcwPub,代码行数:70,


示例9: G_RegisterFireteam

// Should be the only function that ever creates a fireteamvoid G_RegisterFireteam(/*const char* name,*/ int entityNum){	fireteamData_t *ft;	gentity_t      *leader;	int            count, ident;	if (entityNum < 0 || entityNum >= MAX_CLIENTS)	{		G_Error("G_RegisterFireteam: invalid client/n");	}	leader = &g_entities[entityNum];	if (!leader->client)	{		G_Error("G_RegisterFireteam: attempting to register a Fireteam to an entity with no client/n");	}	if (G_IsOnFireteam(entityNum, NULL))	{		G_ClientPrint(entityNum, "You are already on a fireteam, leave it first");		return;	}	if ((ft = G_FindFreeFireteam()) == NULL)	{		G_ClientPrint(entityNum, "No free fireteams available");		return;	}	if (leader->client->sess.sessionTeam != TEAM_AXIS && leader->client->sess.sessionTeam != TEAM_ALLIES)	{		G_ClientPrint(entityNum, "Only players on a team can create a fireteam");		return;	}	count = G_CountTeamFireteams(leader->client->sess.sessionTeam);	if (count >= MAX_FIRETEAMS / 2)	{		G_ClientPrint(entityNum, "Your team already has the maximum number of fireteams allowed");		return;	}	ident = G_FindFreeFireteamIdent(leader->client->sess.sessionTeam) + 1;	if (ident == 0)	{		G_ClientPrint(entityNum, "Um, something is broken, spoink Gordon");		return;	}	// good to go now, i hope!	ft->inuse = qtrue;	memset(ft->joinOrder, -1, sizeof(level.fireTeams[0].joinOrder));	ft->joinOrder[0] = leader - g_entities;	ft->ident        = ident;	if (g_autoFireteams.integer)	{		ft->priv = qfalse;		trap_SendServerCommand(entityNum, "aft -1");		leader->client->pers.autofireteamEndTime = level.time + 20500;	}	else	{		ft->priv = qfalse;	}#ifdef FEATURE_OMNIBOT	Bot_Event_FireTeamCreated(entityNum, ft->ident);	Bot_Event_JoinedFireTeam(leader - g_entities, leader);#endif	G_UpdateFireteamConfigString(ft);}
开发者ID:winrid,项目名称:etlegacy,代码行数:75,


示例10: G_Script_ScriptParse

/*==============G_Script_ScriptParse  Parses the script for the given entity==============*/void G_Script_ScriptParse(gentity_t *ent){	char             *pScript;	char             *token;	qboolean         wantName;	qboolean         inScript;	int              eventNum;	g_script_event_t events[G_MAX_SCRIPT_STACK_ITEMS];	int              numEventItems;	g_script_event_t *curEvent;	// DHM - Nerve :: Some of our multiplayer script commands have longer parameters	//char		params[MAX_QPATH];	char params[MAX_INFO_STRING];	// dhm - end	g_script_stack_action_t *action;	int                     i;	int                     bracketLevel;	qboolean                buildScript;	if (!ent->scriptName)	{		return;	}	if (!level.scriptEntity)	{		return;	}	buildScript = trap_Cvar_VariableIntegerValue("com_buildScript");	pScript  = level.scriptEntity;	wantName = qtrue;	inScript = qfalse;	COM_BeginParseSession("G_Script_ScriptParse");	bracketLevel  = 0;	numEventItems = 0;	memset(events, 0, sizeof(events));	while (1)	{		token = COM_Parse(&pScript);		if (!token[0])		{			if (!wantName)			{				G_Error("G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found./n", COM_GetCurrentParseLine());			}			break;		}		// end of script		if (token[0] == '}')		{			if (inScript)			{				break;			}			if (wantName)			{				G_Error("G_Script_ScriptParse(), Error (line %d): '}' found, but not expected./n", COM_GetCurrentParseLine());			}			wantName = qtrue;		}		else if (token[0] == '{')		{			if (wantName)			{				G_Error("G_Script_ScriptParse(), Error (line %d): '{' found, NAME expected./n", COM_GetCurrentParseLine());			}		}		else if (wantName)		{			if (!Q_stricmp(token, "bot"))			{				// a bot, skip this whole entry				SkipRestOfLine(&pScript);				// skip this section				SkipBracedSection(&pScript);				//				continue;			}			if (!Q_stricmp(token, "entity"))			{				// this is an entity, so go back to look for a name				continue;			}			if (!Q_stricmp(ent->scriptName, token))			{				inScript      = qtrue;				numEventItems = 0;			}//.........这里部分代码省略.........
开发者ID:morsik,项目名称:war-territory,代码行数:101,


示例11: destroyed

//.........这里部分代码省略.........set size better?multiple damage models?custom explosion effect/sound?*/void SP_misc_model_breakable( gentity_t *ent ) {	char	damageModel[MAX_QPATH];	char	chunkModel[MAX_QPATH];	char	useModel[MAX_QPATH];	int		len;		// Chris F. requested default for misc_model_breakable to be NONE...so don't arbitrarily change this.	G_SpawnInt( "material", "8", (int*)&ent->material );	G_SpawnFloat( "radius", "1", &ent->radius ); // used to scale chunk code if desired by a designer	CacheChunkEffects( ent->material );	misc_model_breakable_init( ent );	len = strlen( ent->model ) - 4;	strncpy( damageModel, ent->model, len );	damageModel[len] = 0;	//chop extension	strncpy( chunkModel, damageModel, sizeof(chunkModel));	strncpy( useModel, damageModel, sizeof(useModel));		if (ent->takedamage) {		//Dead/damaged model		if( !(ent->spawnflags & 8) ) {	//no dmodel			strcat( damageModel, "_d1.md3" );			ent->s.modelindex2 = G_ModelIndex( damageModel );		}				//Chunk model		strcat( chunkModel, "_c1.md3" );		ent->s.modelindex3 = G_ModelIndex( chunkModel );	}	//Use model	if( ent->spawnflags & 32 ) {	//has umodel		strcat( useModel, "_u1.md3" );		ent->sound1to2 = G_ModelIndex( useModel );	}	if ( !ent->mins[0] && !ent->mins[1] && !ent->mins[2] )	{		VectorSet (ent->mins, -16, -16, -16);	}	if ( !ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2] )	{		VectorSet (ent->maxs, 16, 16, 16);	}	if ( ent->spawnflags & 2 )	{		ent->s.eFlags |= EF_ANIM_ALLFAST;	}	G_SetOrigin( ent, ent->s.origin );	G_SetAngles( ent, ent->s.angles );	gi.linkentity (ent);	if ( ent->spawnflags & 128 )	{//Can be used by the player's BUTTON_USE		ent->svFlags |= SVF_PLAYER_USABLE;	}	if ( ent->team && ent->team[0] )	{		ent->noDamageTeam = TranslateTeamName( ent->team );		if ( ent->noDamageTeam == TEAM_FREE )		{			G_Error("team name %s not recognized/n", ent->team);		}	}		ent->team = NULL;	//HACK	if ( ent->model && Q_stricmp( "models/map_objects/ships/tie_fighter.md3", ent->model ) == 0 )	{//run a think		G_EffectIndex( "fighter_explosion2" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass1.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass2.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass3.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass4.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass5.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire2.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire3.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/TIEexplode.wav" );		ent->e_ThinkFunc = thinkF_TieFighterThink;		ent->nextthink = level.time + FRAMETIME;	}	float grav = 0;	G_SpawnFloat( "gravity", "0", &grav );	if ( grav )	{//affected by gravity		G_SetAngles( ent, ent->s.angles );		G_SetOrigin( ent, ent->currentOrigin );		misc_model_breakable_gravity_init( ent, qtrue );	}}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:101,


示例12: multiplier

/*QUAKED script_mover (0.5 0.25 1.0) ? TRIGGERSPAWN SOLID EXPLOSIVEDAMAGEONLY RESURECTABLE COMPASS ALLIED AXIS MOUNTED_GUNScripted brush entity. A simplified means of moving brushes around based on events."modelscale" - Scale multiplier (defaults to 1, and scales uniformly)"modelscale_vec" - Set scale per-axis.  Overrides "modelscale", so if you have both the "modelscale" is ignored"model2" optional md3 to draw over the solid clip brush"scriptname" name used for scripting purposes (like aiName in AI scripting)"health" optionally make this entity damagable"description" used with health, if the entity is damagable, it draws a healthbar with this description above it.*/void SP_script_mover(gentity_t *ent){	float  scale[3] = { 1, 1, 1 };	vec3_t scalevec;	char   tagname[MAX_QPATH];	char   *modelname;	char   *tagent;	char   cs[MAX_INFO_STRING];	char   *s;	if (!ent->model)	{		G_Error("script_mover must have a /"model/"/n");	}	if (!ent->scriptName)	{		G_Error("script_mover must have a /"scriptname/"/n");	}	ent->blocked = script_mover_blocked;	// first position at start	VectorCopy(ent->s.origin, ent->pos1);//	VectorCopy( ent->r.currentOrigin, ent->pos1 );	VectorCopy(ent->pos1, ent->pos2);   // don't go anywhere just yet	trap_SetBrushModel(ent, ent->model);	InitMover(ent);	ent->reached        = NULL;	ent->s.animMovetype = 0;	ent->s.density = 0;	if (ent->spawnflags & 256)	{		ent->s.density |= 2;	}	if (ent->spawnflags & 8)	{		ent->use = script_mover_use;	}	if (ent->spawnflags & 16)	{		ent->s.time2 = 1;	}	else	{		ent->s.time2 = 0;	}	if (ent->spawnflags & 32)	{		ent->s.teamNum = TEAM_ALLIES;	}	else if (ent->spawnflags & 64)	{		ent->s.teamNum = TEAM_AXIS;	}	else	{		ent->s.teamNum = TEAM_FREE;	}	if (ent->spawnflags & 1)	{		ent->use = script_mover_use;		trap_UnlinkEntity(ent);   // make sure it's not visible		return;	}	G_SetAngle(ent, ent->s.angles);	G_SpawnInt("health", "0", &ent->health);	if (ent->health)	{		ent->takedamage = qtrue;		ent->count      = ent->health;		// client needs to know about it as well		ent->s.effect1Time  = ent->count;		ent->s.dl_intensity = 255;		if (G_SpawnString("description", "", &s))		{			trap_GetConfigstring(CS_SCRIPT_MOVER_NAMES, cs, sizeof(cs));//.........这里部分代码省略.........
开发者ID:morsik,项目名称:war-territory,代码行数:101,


示例13: sizeof

void *G_Alloc( int size ){	// Find a free block and allocate.	// Does two passes, attempts to fill same-sized free slot first.	struct freememnode *fmn, *prev, *next, *smallest;	int                allocsize, smallestsize;	char               *endptr;	int                *ptr;	allocsize = ( size + sizeof( int ) + ROUNDBITS ) & ~ROUNDBITS;  // Round to 32-byte boundary	ptr = NULL;	smallest = NULL;	smallestsize = POOLSIZE + 1; // Guaranteed not to miss any slots :)	for ( fmn = freehead; fmn; fmn = fmn->next )	{		if ( fmn->cookie != FREEMEMCOOKIE )		{			G_Error( "G_Alloc: Memory corruption detected!/n" );		}		if ( fmn->size >= allocsize )		{			// We've got a block			if ( fmn->size == allocsize )			{				// Same size, just remove				prev = fmn->prev;				next = fmn->next;				if ( prev )				{					prev->next = next; // Point previous node to next				}				if ( next )				{					next->prev = prev; // Point next node to previous				}				if ( fmn == freehead )				{					freehead = next; // Set head pointer to next				}				ptr = ( int * ) fmn;				break; // Stop the loop, this is fine			}			else			{				// Keep track of the smallest free slot				if ( fmn->size < smallestsize )				{					smallest = fmn;					smallestsize = fmn->size;				}			}		}	}	if ( !ptr && smallest )	{		// We found a slot big enough		smallest->size -= allocsize;		endptr = ( char * ) smallest + smallest->size;		ptr = ( int * ) endptr;	}	if ( ptr )	{		freemem -= allocsize;		if ( g_debugAlloc.integer )		{			G_Printf( "G_Alloc of %i bytes (%i left)/n", allocsize, freemem );		}		memset( ptr, 0, allocsize );		*ptr++ = allocsize; // Store a copy of size for deallocation		return ( ( void * ) ptr );	}	G_Error( "G_Alloc: failed on allocation of %i bytes/n", size );	return ( NULL );}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:89,


示例14: G_ScriptAction_GotoMarker

/*===============G_ScriptAction_GotoMarker  syntax: gotomarker <targetname> <speed> [accel/deccel] [turntotarget] [wait]  NOTE: speed may be modified to round the duration to the next 50ms for smooth  transitions===============*/qboolean G_ScriptAction_GotoMarker( gentity_t *ent, char *params ) {    char    *pString, *token;    gentity_t *target;    vec3_t vec;    float speed, dist;    qboolean wait = qfalse, turntotarget = qfalse;    int trType;    int duration, i;    vec3_t diff;    vec3_t angles;    if ( params && ( ent->scriptStatus.scriptFlags & SCFL_GOING_TO_MARKER ) ) {        // we can't process a new movement until the last one has finished        return qfalse;    }    if ( !params || ent->scriptStatus.scriptStackChangeTime < level.time ) {          // we are waiting for it to reach destination        if ( ent->s.pos.trTime + ent->s.pos.trDuration <= level.time ) {  // we made it            ent->scriptStatus.scriptFlags &= ~SCFL_GOING_TO_MARKER;            // set the angles at the destination            BG_EvaluateTrajectory( &ent->s.apos, ent->s.apos.trTime + ent->s.apos.trDuration, ent->s.angles );            VectorCopy( ent->s.angles, ent->s.apos.trBase );            VectorCopy( ent->s.angles, ent->r.currentAngles );            ent->s.apos.trTime = level.time;            ent->s.apos.trDuration = 0;            ent->s.apos.trType = TR_STATIONARY;            VectorClear( ent->s.apos.trDelta );            // stop moving            BG_EvaluateTrajectory( &ent->s.pos, level.time, ent->s.origin );            VectorCopy( ent->s.origin, ent->s.pos.trBase );            VectorCopy( ent->s.origin, ent->r.currentOrigin );            ent->s.pos.trTime = level.time;            ent->s.pos.trDuration = 0;            ent->s.pos.trType = TR_STATIONARY;            VectorClear( ent->s.pos.trDelta );            script_linkentity( ent );            return qtrue;        }    } else {    // we have just started this command        pString = params;        token = COM_ParseExt( &pString, qfalse );        if ( !token[0] ) {            G_Error( "G_Scripting: gotomarker must have an targetname/n" );        }        // find the entity with the given "targetname"        target = G_Find( NULL, FOFS( targetname ), token );        if ( !target ) {            G_Error( "G_Scripting: can't find entity with /"targetname/" = /"%s/"/n", token );        }        VectorSubtract( target->r.currentOrigin, ent->r.currentOrigin, vec );        token = COM_ParseExt( &pString, qfalse );        if ( !token[0] ) {            G_Error( "G_Scripting: gotomarker must have a speed/n" );        }        speed = atof( token );        trType = TR_LINEAR_STOP;        while ( token[0] ) {            token = COM_ParseExt( &pString, qfalse );            if ( token[0] ) {                if ( !Q_stricmp( token, "accel" ) ) {                    trType = TR_ACCELERATE;                } else if ( !Q_stricmp( token, "deccel" ) )      {                    trType = TR_DECCELERATE;                } else if ( !Q_stricmp( token, "wait" ) )      {                    wait = qtrue;                } else if ( !Q_stricmp( token, "turntotarget" ) )      {                    turntotarget = qtrue;                }            }        }        // start the movement        if ( ent->s.eType == ET_MOVER ) {            VectorCopy( vec, ent->movedir );            VectorCopy( ent->r.currentOrigin, ent->pos1 );            VectorCopy( target->r.currentOrigin, ent->pos2 );            ent->speed = speed;            dist = VectorDistance( ent->pos1, ent->pos2 );//.........这里部分代码省略.........
开发者ID:aleksandr-pushkarev,项目名称:RTCW-SP,代码行数:101,


示例15: G_RemoveClientFromFireteams

// The only way a client should be removed from a fireteamvoid G_RemoveClientFromFireteams(int entityNum, qboolean update, qboolean print){	fireteamData_t *ft;	int            i;	if ((entityNum < 0 || entityNum >= MAX_CLIENTS) || !g_entities[entityNum].client)	{		G_Error("G_RemoveClientFromFireteams: invalid client/n");	}	if (G_IsOnFireteam(entityNum, &ft))	{		int j, firstHuman;		for (i = 0; i < MAX_FIRETEAM_MEMBERS && i < g_maxclients.integer; ++i)		{			if (ft->joinOrder[i] == entityNum)			{				if (i == 0)				{					if (ft->joinOrder[1] == -1)					{						ft->inuse = qfalse;						ft->ident = -1;					}					else					{						// core: only bots left in the fireteam? we disband the fireteam..						if (G_OnlyBotsInFireteam(ft, entityNum, &firstHuman))						{							// empty the fireteam							for (j = 0; j < g_maxclients.integer - 1; j++)							{#ifdef FEATURE_OMNIBOT								Bot_Event_LeftFireTeam(ft->joinOrder[j]);#endif								ft->joinOrder[j] = -1;							}							ft->inuse = qfalse;							ft->ident = -1;							G_UpdateFireteamConfigString(ft);							return;						}						else						{							// core: a bot as FT-leader? we try to pick a human..							if (g_entities[(int)(ft->joinOrder[1])].r.svFlags & SVF_BOT)							{								if (firstHuman != -1)								{									// Swap first human with first bot..									int tmp = ft->joinOrder[1];									ft->joinOrder[1]          = ft->joinOrder[firstHuman];									ft->joinOrder[firstHuman] = tmp;								}							}							else							{								firstHuman = 1;							}							// Inform client of promotion to leader							if (firstHuman != -1)							{								trap_SendServerCommand(ft->joinOrder[firstHuman], "cpm /"You are now the leader of your fireteam/"/n");							}						}					}				}				for (j = i; j < g_maxclients.integer - 1; j++)				{					ft->joinOrder[j] = ft->joinOrder[j + 1];				}				ft->joinOrder[g_maxclients.integer - 1] = -1;				break;			}		}	}	else	{		return;	}#ifdef FEATURE_OMNIBOT	Bot_Event_LeftFireTeam(entityNum);#endif	if (print)	{		for (i = 0; i < MAX_CLIENTS; i++)		{			if (ft->joinOrder[i] == -1)			{				break;			}			trap_SendServerCommand(ft->joinOrder[i], va("cpm /"%s ^7has left the Fireteam/"/n", level.clients[entityNum].pers.netname));		}//.........这里部分代码省略.........
开发者ID:winrid,项目名称:etlegacy,代码行数:101,


示例16: G_ScriptAction_Accum

/*=================G_ScriptAction_Accum  syntax: accum <buffer_index> <command> <paramater>  Commands:	accum <n> inc <m>	accum <n> abort_if_less_than <m>	accum <n> abort_if_greater_than <m>	accum <n> abort_if_not_equal <m>	accum <n> abort_if_equal <m>	accum <n> set <m>	accum <n> random <m>	accum <n> bitset <m>	accum <n> bitreset <m>	accum <n> abort_if_bitset <m>	accum <n> abort_if_not_bitset <m>=================*/qboolean G_ScriptAction_Accum( gentity_t *ent, char *params ) {    char *pString, *token, lastToken[MAX_QPATH];    int bufferIndex;    pString = params;    token = COM_ParseExt( &pString, qfalse );    if ( !token[0] ) {        G_Error( "G_Scripting: accum without a buffer index/n" );    }    bufferIndex = atoi( token );    if ( bufferIndex >= G_MAX_SCRIPT_ACCUM_BUFFERS ) {        G_Error( "G_Scripting: accum buffer is outside range (0 - %i)/n", G_MAX_SCRIPT_ACCUM_BUFFERS );    }    token = COM_ParseExt( &pString, qfalse );    if ( !token[0] ) {        G_Error( "G_Scripting: accum without a command/n" );    }    Q_strncpyz( lastToken, token, sizeof( lastToken ) );    token = COM_ParseExt( &pString, qfalse );    if ( !Q_stricmp( lastToken, "inc" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        ent->scriptAccumBuffer[bufferIndex] += atoi( token );    } else if ( !Q_stricmp( lastToken, "abort_if_less_than" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        if ( ent->scriptAccumBuffer[bufferIndex] < atoi( token ) ) {            // abort the current script            ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems;        }    } else if ( !Q_stricmp( lastToken, "abort_if_greater_than" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        if ( ent->scriptAccumBuffer[bufferIndex] > atoi( token ) ) {            // abort the current script            ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems;        }    } else if ( !Q_stricmp( lastToken, "abort_if_not_equal" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        if ( ent->scriptAccumBuffer[bufferIndex] != atoi( token ) ) {            // abort the current script            ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems;        }    } else if ( !Q_stricmp( lastToken, "abort_if_equal" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        if ( ent->scriptAccumBuffer[bufferIndex] == atoi( token ) ) {            // abort the current script            ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems;        }    } else if ( !Q_stricmp( lastToken, "bitset" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        ent->scriptAccumBuffer[bufferIndex] |= ( 1 << atoi( token ) );    } else if ( !Q_stricmp( lastToken, "bitreset" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        ent->scriptAccumBuffer[bufferIndex] &= ~( 1 << atoi( token ) );    } else if ( !Q_stricmp( lastToken, "abort_if_bitset" ) ) {        if ( !token[0] ) {            G_Error( "Scripting: accum %s requires a parameter/n", lastToken );        }        if ( ent->scriptAccumBuffer[bufferIndex] & ( 1 << atoi( token ) ) ) {            // abort the current script            ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems;        }//.........这里部分代码省略.........
开发者ID:aleksandr-pushkarev,项目名称:RTCW-SP,代码行数:101,


示例17: G_ParseAnimationFile

/*======================CG_ParseAnimationFileRead a configuration file containing animation coutns and ratesmodels/players/visor/animation.cfg, etc======================*/qboolean G_ParseAnimationFile( const char *af_filename ) {	const char		*text_p;	int			len;	int			i;	const char		*token;	float		fps;	int			skip;	char		text[40000];	int			animNum;	animation_t	*animations = level.knownAnimFileSets[level.numKnownAnimFileSets].animations;	len = gi.RE_GetAnimationCFG(af_filename, NULL, 0);	if (len <= 0)	{		return qfalse;	}	if ( len <= 0 ) 	{		return qfalse;	}	if ( len >= sizeof( text ) - 1 ) 	{		G_Error( "G_ParseAnimationFile: File %s too long/n (%d > %d)", af_filename, len, sizeof( text ) - 1);		return qfalse;	}	len = gi.RE_GetAnimationCFG(af_filename, text, sizeof(text));	// parse the text	text_p = text;	skip = 0;	// quiet the compiler warning	//FIXME: have some way of playing anims backwards... negative numFrames?	//initialize anim array so that from 0 to MAX_ANIMATIONS, set default values of 0 1 0 100	for(i = 0; i < MAX_ANIMATIONS; i++)	{		animations[i].firstFrame = 0;		animations[i].numFrames = 0;		animations[i].loopFrames = -1;		animations[i].frameLerp = 100;		animations[i].initialLerp = 100;	}	// read information for each frame	while(1) 	{		token = COM_Parse( &text_p );		if ( !token || !token[0]) 		{			break;		}		animNum = GetIDForString(animTable, token);		if(animNum == -1)		{//#ifndef FINAL_BUILD#ifdef _DEBUG			Com_Printf(S_COLOR_RED"WARNING: Unknown token %s in %s/n", token, af_filename);#endif			continue;		}		token = COM_Parse( &text_p );		if ( !token ) 		{			break;		}		animations[animNum].firstFrame = atoi( token );		token = COM_Parse( &text_p );		if ( !token ) 		{			break;		}		animations[animNum].numFrames = atoi( token );		token = COM_Parse( &text_p );		if ( !token ) 		{			break;		}		animations[animNum].loopFrames = atoi( token );		token = COM_Parse( &text_p );		if ( !token ) 		{			break;		}		fps = atof( token );//.........这里部分代码省略.........
开发者ID:Hasimir,项目名称:jedi-outcast-1,代码行数:101,


示例18: teleport_touch

void teleport_touch(){	gedict_t       *t;	vec3_t          org;	if ( self->s.v.targetname )	{		if ( self->s.v.nextthink < g_globalvars.time )		{			return;	// not fired yet		}	}	if ( ( int ) ( self->s.v.spawnflags ) & PLAYER_ONLY )	{		if ( strneq( other->s.v.classname, "player" ) )			return;	}// only teleport living creatures	if ( other->s.v.health <= 0 || other->s.v.solid != SOLID_SLIDEBOX )		return;// activator = other;	SUB_UseTargets();	//put a tfog where the player was	spawn_tfog( other->s.v.origin );	t = find( world, FOFS( s.v.targetname ), self->s.v.target );	if ( !t )		G_Error( "couldn't find target" );// spawn a tfog flash in front of the destination	makevectors( t->mangle );	org[0] = t->s.v.origin[0] + 32 * g_globalvars.v_forward[0];	org[1] = t->s.v.origin[1] + 32 * g_globalvars.v_forward[1];	org[2] = t->s.v.origin[2] + 32 * g_globalvars.v_forward[2];	spawn_tfog( org );	spawn_tdeath( t->s.v.origin, other );// move the player and lock him down for a little while	if ( !other->s.v.health )	{		VectorCopy( t->s.v.origin, other->s.v.origin );		other->s.v.velocity[0] =		    ( g_globalvars.v_forward[0] * other->s.v.velocity[0] ) +		    ( g_globalvars.v_forward[0] * other->s.v.velocity[1] );		other->s.v.velocity[1] =		    ( g_globalvars.v_forward[1] * other->s.v.velocity[0] ) +		    ( g_globalvars.v_forward[1] * other->s.v.velocity[1] );		other->s.v.velocity[2] =		    ( g_globalvars.v_forward[2] * other->s.v.velocity[0] ) +		    ( g_globalvars.v_forward[2] * other->s.v.velocity[1] );		//other->s.v.velocity = (v_forward * other->s.v.velocity[0]) + (v_forward * other->s.v.velocity[1]);		return;	}	setorigin( other, PASSVEC3( t->s.v.origin ) );	VectorCopy( t->mangle, other->s.v.angles );// other.angles = t.mangle;	if ( streq( other->s.v.classname, "player" ) )	{		other->s.v.fixangle = 1;	// turn this way immediately		other->s.v.teleport_time = g_globalvars.time + 0.7;		if ( ( int ) other->s.v.flags & FL_ONGROUND )			other->s.v.flags = other->s.v.flags - FL_ONGROUND;		VectorScale( g_globalvars.v_forward, 300, other->s.v.velocity );//  other->s.v.velocity = v_forward * 300;	}	other->s.v.flags -= ( int ) other->s.v.flags & FL_ONGROUND;}
开发者ID:angeld29,项目名称:qwprogs-qvm,代码行数:73,


示例19: RespawnItem

/*===============RespawnItem===============*/void RespawnItem( gentity_t *ent ) {	// select from teamed entities	if (ent->team) {		gentity_t	*master;		int	count;		int choice;		if ( !ent->teammaster ) {			G_Error( "RespawnItem: bad teammaster");		}		if( ent->spawnflags & 2)	// randomly select from the group		{			master = ent->teammaster;			for (count = 0, ent = master; ent; ent = ent->teamchain, count++)				;			choice = rand() % count;			for (count = 0, ent = master; count < choice; ent = ent->teamchain, count++)				;		}		else	// loop through the group		{			if(ent->teamchain)				ent = ent->teamchain;			else				ent = ent->teammaster;		}	}	if(ent->team)	{		if ( !ent->teammaster )			G_Error( "RespawnItem: bad teammaster");	}	ent->r.contents = CONTENTS_TRIGGER;	ent->s.eFlags &= ~EF_NODRAW;	ent->r.svFlags &= ~SVF_NOCLIENT;	trap_LinkEntity (ent);	if ( ent->item->giType == IT_POWERUP ) {		// play powerup spawn sound to all clients		gentity_t	*te;		// if the powerup respawn sound should Not be global		if (ent->speed) {			te = G_TempEntity( ent->s.pos.trBase, EV_GENERAL_SOUND );		}		else {			te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_SOUND );		}		te->s.eventParm = G_SoundIndex( "sounds/items/powerup_respawn" );		te->r.svFlags |= SVF_BROADCAST;	}	// play the normal respawn sound only to nearby clients	G_AddEvent( ent, EV_ITEM_RESPAWN, 0 );	ent->nextthink = 0;}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:70,


示例20: destroyed

//.........这里部分代码省略.........		ent->r.maxs[0] *= ent->modelScale[0];//*scaleFactor;		ent->r.mins[0] *= ent->modelScale[0];//*scaleFactor;				//scale the y axis of the bbox up.		ent->r.maxs[1] *= ent->modelScale[1];//*scaleFactor;		ent->r.mins[1] *= ent->modelScale[1];//*scaleFactor;				//scale the z axis of the bbox up and adjust origin accordingly		ent->r.maxs[2] *= ent->modelScale[2];		oldMins2 = ent->r.mins[2];		ent->r.mins[2] *= ent->modelScale[2];		ent->s.origin[2] += (oldMins2-ent->r.mins[2]);	}	if ( ent->spawnflags & 2 )	{		ent->s.eFlags |= EF_ANIM_ALLFAST;	}	G_SetOrigin( ent, ent->s.origin );	G_SetAngles( ent, ent->s.angles );	trap_LinkEntity(ent);	if ( ent->spawnflags & 128 )	{//Can be used by the player's BUTTON_USE		ent->r.svFlags |= SVF_PLAYER_USABLE;	}	if ( ent->team && ent->team[0] )	{		ent->teamnodmg= (team_t)GetIDForString( TeamTable, ent->team );		if ( ent->teamnodmg == TEAM_FREE )		{			G_Error("team name %s not recognized/n", ent->team);		}	}		ent->team = NULL;	//HACK	if ( ent->model && Q_stricmp( "models/map_objects/ships/x_wing_nogear.md3", ent->model ) == 0 )	{		if( ent->splashDamage > 0 && ent->splashRadius > 0 )		{			ent->s.loopSound = G_SoundIndex( "sound/vehicles/x-wing/loop.wav" );			/* RAFIXME - impliment this flag?			ent->s.eFlags |= EF_LESS_ATTEN;			*/		}	}	else if ( ent->model && Q_stricmp( "models/map_objects/ships/tie_fighter.md3", ent->model ) == 0 )	{//run a think		G_EffectIndex( "explosions/fighter_explosion2" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass1.wav" );/*		G_SoundIndex( "sound/weapons/tie_fighter/tiepass2.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass3.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass4.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass5.wav" );*/		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire.wav" );/*		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire2.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire3.wav" );*/		G_SoundIndex( "sound/weapons/tie_fighter/TIEexplode.wav" );		//RAFIXME - add Tie Fighter weapon?		//RegisterItem( BG_FindItemForWeapon( WP_TIE_FIGHTER ));		/* RAFIXME - impliment this flag?
开发者ID:ForcePush,项目名称:OJPRPFZ,代码行数:67,


示例21: RegisterItem

/*===============RegisterItemThe item will be added to the precache list===============*/void RegisterItem( gitem_t *item ) {	if ( !item ) {		G_Error( "RegisterItem: NULL" );	}	itemRegistered[ item - bg_itemlist ] = qtrue;}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:13,


示例22: SP_trigger_objective_info

void SP_trigger_objective_info(gentity_t *ent) {	char *scorestring;	char *customimage;	int  cix, cia, objflags;	if (!ent->track) {		G_Error("'trigger_objective_info' does not have a 'track' /n");	}	if ((ent->spawnflags & MESSAGE_OVERRIDE) && !ent->spawnitem) {		G_Error("'trigger_objective_info' has override flag set but no override text/n");	}	// Gordon: for specifying which commandmap objectives this entity "belongs" to	G_SpawnInt("objflags", "0", &objflags);	if (G_SpawnString("customimage", "", &customimage)) {		cix = cia = G_ShaderIndex(customimage);	} else {		if (G_SpawnString("customaxisimage", "", &customimage)) {			cix = G_ShaderIndex(customimage);		} else {			cix = 0;		}		if (G_SpawnString("customalliesimage", "", &customimage)) {			cia = G_ShaderIndex(customimage);		} else if (G_SpawnString("customalliedimage", "", &customimage)) {			cia = G_ShaderIndex(customimage);		} else {			cia = 0;		}	}	G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "e", va("%d", (int)(ent - g_entities)));	G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "o", va("%i", objflags));	G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "cix", va("%i", cix));	G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "cia", va("%i", cia));	G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "s", va("%i", ent->spawnflags));	G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "n", ent->message ? ent->message : "");	if (level.numOidTriggers >= MAX_OID_TRIGGERS) {		G_Error("Exceeded maximum number of 'trigger_objective_info' entities/n");	}	// JPW NERVE -- if this trigger has a "score" field set, then blowing up an objective	//  inside of this field will add "score" to the right player team.  storing this	//  in ent->accuracy since that's unused.	G_SpawnString("score", "0", &scorestring);	ent->accuracy = atof(scorestring);	trap_SetConfigstring(CS_OID_TRIGGERS + level.numOidTriggers, ent->track);	InitTrigger(ent);	if (ent->s.origin[0] || ent->s.origin[1] || ent->s.origin[2]) {		G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "x", va("%i", (int)ent->s.origin[0]));		G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "y", va("%i", (int)ent->s.origin[1]));		G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "z", va("%i", (int)ent->s.origin[2]));	} else {		vec3_t mid;		VectorAdd(ent->r.absmin, ent->r.absmax, mid);		VectorScale(mid, 0.5f, mid);		G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "x", va("%i", (int)mid[0]));		G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "y", va("%i", (int)mid[1]));		G_SetConfigStringValue(CS_OID_DATA + level.numOidTriggers, "z", va("%i", (int)mid[2]));	}	ent->s.teamNum = level.numOidTriggers++;	// unlike other triggers, we need to send this one to the client	ent->r.svFlags &= ~SVF_NOCLIENT;	ent->s.eType    = ET_OID_TRIGGER;	if (!ent->target) {		// no target - just link and go		trap_LinkEntity(ent);	} else {		// Arnout: finalize spawing on fourth frame to allow for proper linking with targets		ent->nextthink = level.time + (3 * FRAMETIME);		ent->think     = Think_SetupObjectiveInfo;	}}
开发者ID:Exosum,项目名称:ETrun,代码行数:84,


示例23: ClientSpawn

/*===========ClientSpawnCalled every time a client is placed fresh in the world:after the first ClientBegin, and after each respawnInitializes all non-persistant parts of playerState============*/void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles ){  int                 index;  vec3_t              spawn_origin, spawn_angles;  gclient_t           *client;  int                 i;  clientPersistant_t  saved;  clientSession_t     savedSess;  int                 persistant[ MAX_PERSISTANT ];  gentity_t           *spawnPoint = NULL;  int                 flags;  int                 savedPing;  int                 teamLocal;  int                 eventSequence;  char                userinfo[ MAX_INFO_STRING ];  vec3_t              up = { 0.0f, 0.0f, 1.0f };  int                 maxAmmo, maxClips;  weapon_t            weapon;  index = ent - g_entities;  client = ent->client;  teamLocal = client->pers.teamSelection;  //if client is dead and following teammate, stop following before spawning  if( client->sess.spectatorClient != -1 )  {    client->sess.spectatorClient = -1;    client->sess.spectatorState = SPECTATOR_FREE;  }  // only start client if chosen a class and joined a team  if( client->pers.classSelection == PCL_NONE && teamLocal == TEAM_NONE )    client->sess.spectatorState = SPECTATOR_FREE;  else if( client->pers.classSelection == PCL_NONE )    client->sess.spectatorState = SPECTATOR_LOCKED;  // if client is dead and following teammate, stop following before spawning  if( ent->client->sess.spectatorState == SPECTATOR_FOLLOW )    G_StopFollowing( ent );  if( origin != NULL )    VectorCopy( origin, spawn_origin );  if( angles != NULL )    VectorCopy( angles, spawn_angles );  // find a spawn point  // do it before setting health back up, so farthest  // ranging doesn't count this client  if( client->sess.spectatorState != SPECTATOR_NOT )  {    if( teamLocal == TEAM_NONE )      spawnPoint = G_SelectSpectatorSpawnPoint( spawn_origin, spawn_angles );    else if( teamLocal == TEAM_ALIENS )      spawnPoint = G_SelectAlienLockSpawnPoint( spawn_origin, spawn_angles );    else if( teamLocal == TEAM_HUMANS )      spawnPoint = G_SelectHumanLockSpawnPoint( spawn_origin, spawn_angles );  }  else  {    if( spawn == NULL )    {      G_Error( "ClientSpawn: spawn is NULL/n" );      return;    }    spawnPoint = spawn;    if( ent != spawn )    {      //start spawn animation on spawnPoint      G_SetBuildableAnim( spawnPoint, BANIM_SPAWN1, qtrue );      if( spawnPoint->buildableTeam == TEAM_ALIENS )        spawnPoint->clientSpawnTime = ALIEN_SPAWN_REPEAT_TIME;      else if( spawnPoint->buildableTeam == TEAM_HUMANS )        spawnPoint->clientSpawnTime = HUMAN_SPAWN_REPEAT_TIME;    }  }  // toggle the teleport bit so the client knows to not lerp  flags = ( ent->client->ps.eFlags & EF_TELEPORT_BIT ) ^ EF_TELEPORT_BIT;  G_UnlaggedClear( ent );  // clear everything but the persistant data  saved = client->pers;  savedSess = client->sess;  savedPing = client->ps.ping;//.........这里部分代码省略.........
开发者ID:librelous,项目名称:librelous,代码行数:101,


示例24: G_TryPushingEntity

/**Returns qfalse if the move is blocked*/static qboolean	G_TryPushingEntity(gentity_t *check, gentity_t *pusher, vec3_t move, vec3_t amove){	vec3_t		matrix[3], transpose[3];	vec3_t		org, org2, move2;	gentity_t	*block;	// EF_MOVER_STOP will just stop when contacting another entity	// instead of pushing it, but entities can still ride on top of it	if ((pusher->s.eFlags & EF_MOVER_STOP) &&		check->s.groundEntityNum != pusher->s.number) {		return qfalse;	}	// save off the old position	if (pushed_p > &pushed[MAX_GENTITIES]) {		G_Error("pushed_p > &pushed[MAX_GENTITIES]");	}	pushed_p->ent = check;	VectorCopy(check->s.pos.trBase, pushed_p->origin);	VectorCopy(check->s.apos.trBase, pushed_p->angles);	if (check->client) {		pushed_p->deltayaw = check->client->ps.delta_angles[YAW];		VectorCopy(check->client->ps.origin, pushed_p->origin);	}	pushed_p++;	// try moving the contacted entity	// figure movement due to the pusher's amove	G_CreateRotationMatrix(amove, transpose);	G_TransposeMatrix(transpose, matrix);	if (check->client) {		VectorSubtract(check->client->ps.origin, pusher->r.currentOrigin, org);	}	else {		VectorSubtract(check->s.pos.trBase, pusher->r.currentOrigin, org);	}	VectorCopy(org, org2);	G_RotatePoint(org2, matrix);	VectorSubtract(org2, org, move2);	// add movement	VectorAdd(check->s.pos.trBase, move, check->s.pos.trBase);	VectorAdd(check->s.pos.trBase, move2, check->s.pos.trBase);	if (check->client) {		VectorAdd(check->client->ps.origin, move, check->client->ps.origin);		VectorAdd(check->client->ps.origin, move2, check->client->ps.origin);		// make sure the client's view rotates when on a rotating mover		check->client->ps.delta_angles[YAW] += ANGLE2SHORT(amove[YAW]);	}	// may have pushed them off an edge	if (check->s.groundEntityNum != pusher->s.number) {		check->s.groundEntityNum = ENTITYNUM_NONE;	}	block = G_TestEntityPosition(check);	if (!block) {		// pushed ok		if (check->client) {			VectorCopy(check->client->ps.origin, check->r.currentOrigin);		} else {			VectorCopy(check->s.pos.trBase, check->r.currentOrigin);		}		trap_LinkEntity (check);		return qtrue;	}	// if it is ok to leave in the old position, do it	// this is only relevent for riding entities, not pushed	// Sliding trapdoors can cause this.	VectorCopy((pushed_p-1)->origin, check->s.pos.trBase);	if (check->client) {		VectorCopy((pushed_p-1)->origin, check->client->ps.origin);	}	VectorCopy((pushed_p-1)->angles, check->s.apos.trBase);	block = G_TestEntityPosition (check);	if (!block) {		check->s.groundEntityNum = ENTITYNUM_NONE;		pushed_p--;		return qtrue;	}	// blocked	return qfalse;}
开发者ID:baseas,项目名称:aftershock,代码行数:87,


示例25: while

/*===========G_SelectRandomFurthestSpawnPointChooses a player start, deathmatch start, etc============*/gentity_t *G_SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ){  gentity_t *spot;  vec3_t    delta;  float     dist;  float     list_dist[ 64 ];  gentity_t *list_spot[ 64 ];  int       numSpots, rnd, i, j;  numSpots = 0;  spot = NULL;  while( ( spot = G_Find( spot, FOFS( classname ), "info_player_deathmatch" ) ) != NULL )  {    if( SpotWouldTelefrag( spot ) )      continue;    VectorSubtract( spot->s.origin, avoidPoint, delta );    dist = VectorLength( delta );    for( i = 0; i < numSpots; i++ )    {      if( dist > list_dist[ i ] )      {        if( numSpots >= 64 )          numSpots = 64 - 1;        for( j = numSpots; j > i; j-- )        {          list_dist[ j ] = list_dist[ j - 1 ];          list_spot[ j ] = list_spot[ j - 1 ];        }        list_dist[ i ] = dist;        list_spot[ i ] = spot;        numSpots++;        if( numSpots > 64 )          numSpots = 64;        break;      }    }    if( i >= numSpots && numSpots < 64 )    {      list_dist[ numSpots ] = dist;      list_spot[ numSpots ] = spot;      numSpots++;    }  }  if( !numSpots )  {    spot = G_Find( NULL, FOFS( classname ), "info_player_deathmatch" );    if( !spot )      G_Error( "Couldn't find a spawn point" );    VectorCopy( spot->s.origin, origin );    origin[ 2 ] += 9;    VectorCopy( spot->s.angles, angles );    return spot;  }  // select a random spot from the spawn points furthest away  rnd = random( ) * ( numSpots / 2 );  VectorCopy( list_spot[ rnd ]->s.origin, origin );  origin[ 2 ] += 9;  VectorCopy( list_spot[ rnd ]->s.angles, angles );  return list_spot[ rnd ];}
开发者ID:librelous,项目名称:librelous,代码行数:81,


示例26: while

/*===========SelectRandomFurthestSpawnPointChooses a player start, deathmatch start, etc============*/gentity_t *SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles, qboolean isbot ) {	gentity_t	*spot;	vec3_t		delta;	float		dist;	float		list_dist[MAX_SPAWN_POINTS];	gentity_t	*list_spot[MAX_SPAWN_POINTS];	int			numSpots, rnd, i, j;	numSpots = 0;	spot = NULL;	while((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL)	{		if(SpotWouldTelefrag(spot))			continue;		if(((spot->flags & FL_NO_BOTS) && isbot) ||		   ((spot->flags & FL_NO_HUMANS) && !isbot))		{			// spot is not for this human/bot player			continue;		}		VectorSubtract( spot->s.origin, avoidPoint, delta );		dist = VectorLength( delta );		for (i = 0; i < numSpots; i++)		{			if(dist > list_dist[i])			{				if (numSpots >= MAX_SPAWN_POINTS)					numSpots = MAX_SPAWN_POINTS - 1;									for(j = numSpots; j > i; j--)				{					list_dist[j] = list_dist[j-1];					list_spot[j] = list_spot[j-1];				}								list_dist[i] = dist;				list_spot[i] = spot;								numSpots++;				break;			}		}				if(i >= numSpots && numSpots < MAX_SPAWN_POINTS)		{			list_dist[numSpots] = dist;			list_spot[numSpots] = spot;			numSpots++;		}	}		if(!numSpots)	{		spot = G_Find(NULL, FOFS(classname), "info_player_deathmatch");		if (!spot)			G_Error( "Couldn't find a spawn point" );		VectorCopy (spot->s.origin, origin);		origin[2] += 9;		VectorCopy (spot->s.angles, angles);		return spot;	}	// select a random spot from the spawn points furthest away	rnd = random() * (numSpots / 2);	VectorCopy (list_spot[rnd]->s.origin, origin);	origin[2] += 9;	VectorCopy (list_spot[rnd]->s.angles, angles);	return list_spot[rnd];}
开发者ID:mecwerks,项目名称:revamp,代码行数:84,


示例27: G_ScriptAction_PlayAnim

/*=================G_ScriptAction_PlayAnim  syntax: playanim <startframe> <endframe> [looping <FOREVER/duration>] [rate <FPS>]  NOTE: all source animations must be at 20fps=================*/qboolean G_ScriptAction_PlayAnim( gentity_t *ent, char *params ) {    char *pString, *token, tokens[2][MAX_QPATH];    int i, endtime = 0; // TTimo: init    qboolean looping = qfalse, forever = qfalse;    int startframe, endframe, idealframe;    int rate = 20;    if ( ( ent->scriptStatus.scriptFlags & SCFL_ANIMATING ) && ( ent->scriptStatus.scriptStackChangeTime == level.time ) ) {        // this is a new call, so cancel the previous animation        ent->scriptStatus.scriptFlags &= ~SCFL_ANIMATING;    }    pString = params;    for ( i = 0; i < 2; i++ ) {        token = COM_ParseExt( &pString, qfalse );        if ( !token || !token[0] ) {            G_Printf( "G_Scripting: syntax error/n/nplayanim <startframe> <endframe> [LOOPING <duration>]/n" );            return qtrue;        } else {            Q_strncpyz( tokens[i], token, sizeof( tokens[i] ) );        }    }    startframe = atoi( tokens[0] );    endframe = atoi( tokens[1] );    // check for optional parameters    token = COM_ParseExt( &pString, qfalse );    if ( token[0] ) {        if ( !Q_strcasecmp( token, "looping" ) ) {            looping = qtrue;            token = COM_ParseExt( &pString, qfalse );            if ( !token || !token[0] ) {                G_Printf( "G_Scripting: syntax error/n/nplayanim <startframe> <endframe> [LOOPING <duration>]/n" );                return qtrue;            }            if ( !Q_strcasecmp( token, "untilreachmarker" ) ) {                if ( level.time < ent->s.pos.trTime + ent->s.pos.trDuration ) {                    endtime = level.time + 100;                } else {                    endtime = 0;                }            } else if ( !Q_strcasecmp( token, "forever" ) ) {                ent->scriptStatus.animatingParams = params;                ent->scriptStatus.scriptFlags |= SCFL_ANIMATING;                endtime = level.time + 100;     // we don't care when it ends, since we are going forever!                forever = qtrue;            } else {                endtime = ent->scriptStatus.scriptStackChangeTime + atoi( token );            }            token = COM_ParseExt( &pString, qfalse );        }        if ( token[0] && !Q_strcasecmp( token, "rate" ) ) {            token = COM_ParseExt( &pString, qfalse );            if ( !token[0] ) {                G_Error( "G_Scripting: playanim has RATE parameter without an actual rate specified" );            }            rate = atoi( token );        }        if ( !looping ) {            endtime = ent->scriptStatus.scriptStackChangeTime + ( ( endframe - startframe ) * ( 1000 / 20 ) );        }    }    idealframe = startframe + (int)floor( (float)( level.time - ent->scriptStatus.scriptStackChangeTime ) / ( 1000.0 / (float)rate ) );    if ( looping ) {        ent->s.frame = startframe + ( idealframe - startframe ) % ( endframe - startframe );        ent->s.eFlags |= EF_MOVER_ANIMATE;    } else {        if ( idealframe > endframe ) {            ent->s.frame = endframe;            ent->s.eFlags &= ~EF_MOVER_ANIMATE; // stop interpolation, since we have gone passed the endframe        } else {            ent->s.frame = idealframe;            ent->s.eFlags |= EF_MOVER_ANIMATE;        }    }    if ( forever ) {        ent->s.eFlags |= EF_MOVER_ANIMATE;        return qtrue;   // continue to the next command    }    if ( endtime <= level.time ) {        ent->s.eFlags &= ~EF_MOVER_ANIMATE; // stop animating        return qtrue;//.........这里部分代码省略.........
开发者ID:aleksandr-pushkarev,项目名称:RTCW-SP,代码行数:101,


示例28: EvaluateField

//.........这里部分代码省略.........	{	case F_STRING:		*(char **)pv = GetStringPtr(*(int *)pv, pbOriginalRefData?*(char**)pvOriginal:NULL);		break;	case F_GENTITY:		*(gentity_t **)pv = GetGEntityPtr(*(int *)pv);		break;	case F_GROUP:		*(AIGroupInfo_t **)pv = GetGroupPtr(*(int *)pv);		break;	case F_GCLIENT:		*(gclient_t **)pv = GetGClientPtr(*(int *)pv);		break;	case F_ITEM:		*(gitem_t **)pv = GetGItemPtr(*(int *)pv);		break;	case F_VEHINFO:		*(vehicleInfo_t **)pv = GetVehicleInfoPtr(*(int *)pv);		break;	case F_BEHAVIORSET:		{			char **p = (char **) pv;			char **pO= (char **) pvOriginal;			for (int i=0; i<NUM_BSETS; i++, p++, pO++)			{				*p = GetStringPtr(*(int *)p, pbOriginalRefData?*(char **)pO:NULL);			}		}		break;/*MCG	case F_BODYQUEUE:		{			gentity_t **p = (gentity_t **) pv;			for (int i=0; i<BODY_QUEUE_SIZE; i++, p++)			{				*p = GetGEntityPtr(*(int *)p);			}		}		break;*/	case F_ALERTEVENT:		{							alertEvent_t* p = (alertEvent_t *) pv;			for (int i=0; i<MAX_ALERT_EVENTS; i++)			{				p[i].owner = GetGEntityPtr((intptr_t)(p[i].owner));			}		}		break;	case F_AIGROUPS:	// convert to ptrs within this into indexes...		{			AIGroupInfo_t* p = (AIGroupInfo_t *) pv;			for (int i=0; i<MAX_FRAME_GROUPS; i++)			{				p[i].enemy		= GetGEntityPtr((intptr_t)(p[i].enemy));				p[i].commander	= GetGEntityPtr((intptr_t)(p[i].commander));			}		}		break;	case F_ANIMFILESETS:		{			animFileSet_t* p = (animFileSet_t *) pv;			char *pO;			for (int i=0; i<MAX_ANIM_FILES; i++)			{				for ( int j=0; j<MAX_ANIM_EVENTS; j++ )				{					pO = pbOriginalRefData ? level.knownAnimFileSets[i].torsoAnimEvents[j].stringData : NULL;					p[i].torsoAnimEvents[j].stringData = GetStringPtr((intptr_t)p[i].torsoAnimEvents[j].stringData, pO);					pO = pbOriginalRefData ? level.knownAnimFileSets[i].legsAnimEvents[j].stringData : NULL;					p[i].legsAnimEvents[j].stringData = GetStringPtr((intptr_t)p[i].legsAnimEvents[j].stringData, pO);				}			}		}		break;//	// These fields are patched in when their relevant owners are loaded	case F_BOOLPTR:	case F_NULL:		break;	case F_IGNORE:		break;	default:		G_Error ("EvaluateField: unknown field type");		break;	}}
开发者ID:archSeer,项目名称:OpenJK,代码行数:101,


示例29: G_AddBot

//.........这里部分代码省略.........		Info_SetValueForKey(userinfo, "spawnPoint", spawnPoint);	}	if (scriptName && scriptName[0])	{		Info_SetValueForKey(userinfo, "scriptName", scriptName);	}/*	if (playerClass > 0) {        Info_SetValueForKey( userinfo, "pClass", va("%i", playerClass) );    }    if (playerWeapon) {        Info_SetValueForKey( userinfo, "pWeapon", va("%i", playerWeapon) );    }*/	// END Mad Doc - TDF	key = "wolfbot";	if (!Q_stricmp((char *)name, key))	{		// read the botnames file, and pick a name that doesnt exist		fileHandle_t f;		int          len, i, j, k;		qboolean     setname = qfalse;		char         botnames[8192], *pbotnames, *listbotnames[MAX_BOTNAMES], *token, *oldpbotnames;		int          lengthbotnames[MAX_BOTNAMES];		len = trap_FS_FOpenFile("botfiles/botnames.txt", &f, FS_READ);		if (len >= 0)		{			if (len > sizeof(botnames))			{				G_Error("botfiles/botnames.txt is too big (max = %i)", (int)sizeof(botnames));			}			memset(botnames, 0, sizeof(botnames));			trap_FS_Read(botnames, len, f);			pbotnames = botnames;			// read them in			i            = 0;			oldpbotnames = pbotnames;			while ((token = COM_Parse(&pbotnames)))			{				if (!token[0])				{					break;				}				listbotnames[i]                    = strstr(oldpbotnames, token);				lengthbotnames[i]                  = strlen(token);				listbotnames[i][lengthbotnames[i]] = 0;				oldpbotnames                       = pbotnames;				if (++i == MAX_BOTNAMES)				{					break;				}			}			//			if (i > 2)			{				j = rand() % (i - 1);   // start at a random spot inthe list				for (k = j + 1; k != j; k++)				{					if (k == i)					{						k = -1; // gets increased on next loop						continue;
开发者ID:morsik,项目名称:war-territory,代码行数:67,



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


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