Exemple #1
0
//QED comment is in bg_misc
//------------------------------------------------------------
void SP_misc_shield_floor_unit( gentity_t *ent )
{
	vec3_t dest;
	trace_t tr;

	if (g_gametype.integer != GT_CTF &&
		g_gametype.integer != GT_CTY)
	{
		G_FreeEntity( ent );
		return;
	}

	VectorSet( ent->r.mins, -16, -16, 0 );
	VectorSet( ent->r.maxs, 16, 16, 40 );

	ent->s.origin[2] += 0.1;
	ent->r.maxs[2] -= 0.1;

	VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );
	trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );
	if ( tr.startsolid )
	{
		G_Printf ("SP_misc_shield_floor_unit: misc_shield_floor_unit startsolid at %s\n", vtos(ent->s.origin));
		G_FreeEntity( ent );
		return;
	}

	//add the 0.1 back after the trace
	ent->r.maxs[2] += 0.1;

	// allow to ride movers
	ent->s.groundEntityNum = tr.entityNum;

	G_SetOrigin( ent, tr.endpos );

	if (!ent->health)
	{
		ent->health = 60;
	}

	if (!ent->model || !ent->model[0])
	{
		ent->model = "/models/items/a_shield_converter.md3";
	}

	ent->s.modelindex = G_ModelIndex( ent->model );

	ent->s.eFlags = 0;
	ent->r.svFlags |= SVF_PLAYER_USABLE;
	ent->r.contents = CONTENTS_SOLID;
	ent->clipmask = MASK_SOLID;

	EnergyShieldStationSettings(ent);

	ent->boltpoint4 = ent->count; //initial value
	ent->think = check_recharge;
	ent->nextthink = level.time + STATION_RECHARGE_TIME;

	ent->use = shield_power_converter_use;

	VectorCopy( ent->s.angles, ent->s.apos.trBase );
	trap_LinkEntity (ent);

	G_SoundIndex("sound/interface/shieldcon_run.wav");
	G_SoundIndex("sound/interface/shieldcon_done.mp3");
	G_SoundIndex("sound/interface/shieldcon_empty.mp3");
}
Exemple #2
0
BOOL CPreStylePag::ModifyTextStyleProperty(
                       CString strTSName,
                       CString strShxFile,
                       CString strBigFile,
                       double  dHeight,
                       double  dWidthFactor,
                       double  dAngleByDegree,
                       short   iGenerationFlag)
{
    CMObject obj, tsobj;
    long     i, nCount;
    CString  strtmp;
//    HRESULT  retCode;

    //进行参数检查和初始化
    strTSName.TrimLeft();
    strTSName.TrimRight();
    strTSName.MakeUpper();
    if(strTSName.GetLength() <= 0) return FALSE;

    strShxFile.TrimLeft();
    strShxFile.TrimRight();
    if(strShxFile.GetLength() <= 0) return FALSE;

    strBigFile.TrimLeft();
    strBigFile.TrimRight();
    if(strBigFile.GetLength() <= 0) return FALSE;
    if(strBigFile == "不使用大字体") strBigFile = "";

    if(dHeight < 0.0) return FALSE;
    if(dWidthFactor < 0.0) return FALSE;
    if(dAngleByDegree > 85.0 || dAngleByDegree < -85.0) return FALSE;
    iGenerationFlag &= 0x06;
    if(dAngleByDegree < 0) dAngleByDegree += 360;
    dAngleByDegree *= 3.14159265359;
    dAngleByDegree /= 180.0;

    try
    {
        if(FindAcad() == FALSE)
        {
            return FALSE;
        }
        
        //SETUP-1: 获取ACAD文本样式列表
        obj = EDIBAcad::objAcadDoc.GetPropertyByName(
                                      _T("TextStyles"));
        
        //SETUP-2: 获取样式对象

		nCount = (long)obj.GetPropertyByName(_T("Count"));
		for( i = 0; i < nCount; i++)
		{
			tsobj = obj.Invoke(_T("Item"), 1, &_variant_t(i));
			strtmp = vtos(tsobj.GetPropertyByName(_T("Name")));
			strtmp.TrimLeft();
            strtmp.TrimRight();
			strtmp.MakeUpper();
			if(strtmp == strTSName)
			{
                //更改目标样式的属性值
                tsobj.PutPropertyByName(_T("FontFile"),           //设定字体文件名
                                       &_variant_t(strShxFile));
                
                tsobj.PutPropertyByName(_T("BigFontFile"),        //设定大字体文件名
                                       &_variant_t(strBigFile));
                
                tsobj.PutPropertyByName(_T("Height"),             //设定字体高度
                                       &_variant_t(dHeight));
                tsobj.PutPropertyByName(_T("Width"),              //设定宽度比例因子***
                                       &_variant_t(dWidthFactor));
                tsobj.PutPropertyByName(_T("ObliqueAngle"),       //设定字体倾斜角度
                                       &_variant_t(dAngleByDegree));
                tsobj.PutPropertyByName(_T("TextGenerationFlag"), //设定字体生成字段
                                       &_variant_t(iGenerationFlag));
                return TRUE;
			}
		}
    }
	catch (_com_error &e)
	{
		CString strMsg;
		strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
		AfxMessageBox(strMsg);
	}
    catch(...)
    {
    }
    return FALSE;
}
/*
===========
G_SetupPath

ent is the who is going to use the path
target is the targetname of the first path entity in the path

This function also supports pervTrain, so that paths can be two way.

Based on Q3's g_mover.c's Think_SetupTrainTargets
===========
*/
static gpathtype_e G_SetupPath2(gentity_t *ent, const char *target)
{
	gentity_t		*path, *next, *start;
	int 			i = 0, prev_flags = 0;
	qboolean pathNotBegin = qfalse; // qtrue it trying to start a path entity without PATHF_BEGIN

	if (!ent) {
		return PATH_ERROR;
	}

	ent->prevTrain = NULL;
	ent->nextTrain = NULL;

	if (!target || target[0] == '\0') {
		// This is supported, so its not really an error...
		return PATH_ERROR;
	}

	// Only start path on a path entity not just the first one we find,
	//    also support PATHF_BEGIN
	do {
		ent->nextTrain = G_Find( ent->nextTrain, FOFS(targetname), target );
		if ( !ent->nextTrain )
		{
			if (pathNotBegin)
				G_Printf( "Entity using paths at %s with a target of wrong path type\n",
					vtos(ent->r.absmin) );
			else
				G_Printf( "Entity using paths at %s with an unfound target\n",
					vtos(ent->r.absmin) );
			return PATH_ERROR;
		}

		// Check for all path types, not just "path_corner"
		for (i=0; gpathinfo[i].classname; i++)
		{
			if (!strcmp( ent->nextTrain->classname, gpathinfo[i].classname ))
			{
				if (gpathinfo[i].flags & PATHF_BEGIN)
				{
					pathNotBegin = qfalse;
					break;
				}
				else
				{
					pathNotBegin = qtrue;
				}
			}
		}
	} while ( !gpathinfo[i].classname );

	// First two path entities are linked, and the second one's prev is the first one.
	// This means that the path was already setup,
	if (ent->nextTrain->nextTrain &&
		ent->nextTrain->nextTrain->prevTrain == ent->nextTrain
		&& (ent->nextTrain->pathflags & PATH_FIRST))
	{
		// The path's nextTrain should only be set here is this should be fine,
		//  unless somehow a mapper changed the path after the train was started...

		if (ent->nextTrain->pathflags & PATH_CIRCIT)
			return PATH_CIRCIT;
		else if (ent->nextTrain->pathflags & PATH_LINE)
			return PATH_LINE;
		else
			return PATH_ERROR;
	}

	start = NULL;
	next = NULL;
	for ( path = ent->nextTrain ; path != start ; path = next ) {
		if ( !start ) {
			start = path;
			start->prevTrain = NULL;
			start->pathflags = PATH_FIRST;
		}

		if ( !path->target )
		{
			// End path properly
			start->pathflags = PATH_LINE | PATH_FIRST;
			path->pathflags = PATH_LINE | PATH_LAST;
			path->nextTrain = NULL;

			if (prev_flags & PATHF_CANFINISH)
			{
				return PATH_LINE; // path ended normally.
			}

			G_Printf( "Path entity at %s without a target\n",
				vtos(path->s.origin) );
			return PATH_ERROR;
		}

		// find a path_corner among the targets
		// there may also be other targets that get fired when the corner
		// is reached
		next = NULL;
		do {
			next = G_Find( next, FOFS(targetname), path->target );
			if ( !next )
			{
				// End path properly
				start->pathflags = PATH_LINE | PATH_FIRST;
				path->pathflags = PATH_LINE | PATH_LAST;
				path->nextTrain = NULL;

				if (prev_flags & PATHF_CANFINISH)
				{
					return PATH_LINE; // path ended normally.
				}

				G_Printf( "Path entity at %s without a target path entity\n",
					vtos(path->s.origin) );
				return PATH_ERROR;
			}

			// Check for all path types, not just "path_corner"
			for (i=0; gpathinfo[i].classname; i++)
			{
				if (!strcmp( next->classname, gpathinfo[i].classname ) )
					break;
			}
		} while ( !gpathinfo[i].classname );

		path->nextTrain = next;
		// Link prevTrain so we can go backward on the path too.
		next->prevTrain = path;

		// If it found a valid path entity and its end the path,
		//  quit linking.
		if (gpathinfo[i].flags & PATHF_FINISH)
		{
			start->pathflags = PATH_LINE | PATH_FIRST;
			next->pathflags = PATH_LINE | PATH_LAST;
			next->nextTrain = NULL;
			ent->prevTrain = NULL;
			return PATH_LINE;
		}
		if ((gpathinfo[i].flags & PATHF_CANFINISH) && !next->target)
		{
			start->pathflags = PATH_LINE | PATH_FIRST;
			next->pathflags = PATH_LINE | PATH_LAST;
			next->nextTrain = NULL;
			ent->prevTrain = NULL;
			return PATH_LINE;
		}

		prev_flags = gpathinfo[i].flags;
	}

	// If we made it here the path is a circit, so link the first and last.
	start->pathflags = PATH_CIRCIT | PATH_FIRST;
	start->prevTrain->pathflags = PATH_CIRCIT | PATH_LAST;

	ent->nextTrain = start;
	ent->prevTrain = start->prevTrain;

	return PATH_CIRCIT;
}
void train_spline_next (edict_t *self)
{
	edict_t		*ent;
	vec3_t		dest;
	qboolean	first;
	vec3_t		angles,v;

	first = true;
again:
	if (!self->target)
	{
		self->s.sound = 0;
		return;
	}

	ent = G_PickTarget (self->target);
	if (!ent)
	{
		gi.dprintf ("train_spline_next: bad target %s\n", self->target);
		return;
	}

	// spline stuff:
	self->from = self->to;
	self->to   = ent;
	VectorSubtract(self->from->s.origin,self->to->s.origin,v);
	self->moveinfo.distance = VectorLength(v);
	self->moveinfo.ratio = 0.0;
	// end spline stuff
	self->target = ent->target;

	// check for a teleport path_corner
	if (ent->spawnflags & 1)
	{
		if (!first)
		{
			gi.dprintf ("connected teleport path_corners, see %s at %s\n", ent->classname, vtos(ent->s.origin));
			return;
		}
		first = false;
		VectorSubtract (ent->s.origin, self->mins, self->s.origin);
		VectorCopy (self->s.origin, self->s.old_origin);
		self->s.event = EV_OTHER_TELEPORT;
		gi.linkentity (self);
		goto again;
	}

	self->moveinfo.wait = ent->wait;
	self->target_ent = ent;

	if (!(self->flags & FL_TEAMSLAVE))
	{
		if (self->moveinfo.sound_start)
			gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
		self->s.sound = self->moveinfo.sound_middle;
	}

	VectorSubtract (ent->s.origin, self->mins, dest);
	self->moveinfo.state = STATE_TOP;
	VectorCopy (self->s.origin, self->moveinfo.start_origin);
	VectorCopy (dest, self->moveinfo.end_origin);

	// Rroff rotating
	if (self->spawnflags & TRAIN_ROTATE && !(ent->spawnflags & 2))
	{
		// Lazarus: No no no :-). This is measuring from the center
		//          of the func_train to the path_corner. Should
		//          be path_corner to path_corner.
		//VectorSubtract (ent->s.origin, self->s.origin, v);
		VectorAdd(self->s.origin,self->mins,v);
		VectorSubtract(ent->s.origin,v,v);
		vectoangles(v,angles);
		self->ideal_yaw = angles[YAW];
		self->ideal_pitch = angles[PITCH];
		if(self->ideal_pitch < 0) self->ideal_pitch += 360;
		self->ideal_roll = ent->roll;

		VectorClear(self->movedir);
		self->movedir[1] = 1.0;
	}
	Move_Calc (self, dest, train_spline_wait);
	self->spawnflags |= TRAIN_START_ON;
}
Exemple #5
0
void FinishSpawningItem( gentity_t *ent ) {
	trace_t		tr;
	vec3_t		dest;
	gitem_t		*item;
	int			itemNum;

	itemNum=1;
	for ( item = bg_itemlist + 1 ; item->classname ; item++,itemNum++)
	{
		if (!strcmp(item->classname,ent->classname))
		{
			break;
		}
	}

	// Set bounding box for item
	VectorSet( ent->mins, item->mins[0],item->mins[1] ,item->mins[2]);
	VectorSet( ent->maxs, item->maxs[0],item->maxs[1] ,item->maxs[2]);

	if ((!ent->mins[0] && !ent->mins[1] && !ent->mins[2]) &&
		(!ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2]))
	{
		VectorSet (ent->mins, -ITEM_RADIUS, -ITEM_RADIUS, -2);//to match the comments in the items.dat file!
		VectorSet (ent->maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);
	}

	if ((item->quantity) && (item->giType == IT_AMMO))
	{
		ent->count = item->quantity;
	}

	if ((item->quantity) && (item->giType == IT_BATTERY))
	{
		ent->count = item->quantity;
	}

	ent->s.radius = 20;
	VectorSet( ent->s.modelScale, 1.0f, 1.0f, 1.0f );

	if ( ent->item->giType == IT_WEAPON
		&& ent->item->giTag == WP_SABER
		&& ent->NPC_type
		&& ent->NPC_type[0] )
	{
		saberInfo_t itemSaber;
		if ( Q_stricmp( "player", ent->NPC_type ) == 0
			&& g_saber->string
			&& g_saber->string[0]
			&& Q_stricmp( "none", g_saber->string )
			&& Q_stricmp( "NULL", g_saber->string ) )
		{//player's saber
			WP_SaberParseParms( g_saber->string, &itemSaber );
		}
		else
		{//specific saber
			WP_SaberParseParms( ent->NPC_type, &itemSaber );
		}
		//NOTE:  should I keep this string around for any reason?  Will I ever need it later?
		//ent->??? = G_NewString( itemSaber.model );
		gi.G2API_InitGhoul2Model( ent->ghoul2, itemSaber.model, G_ModelIndex( itemSaber.model ), NULL_HANDLE, NULL_HANDLE, 0, 0);
		WP_SaberFreeStrings(itemSaber);
	}
	else
	{
		gi.G2API_InitGhoul2Model( ent->ghoul2, ent->item->world_model, G_ModelIndex( ent->item->world_model ), NULL_HANDLE, NULL_HANDLE, 0, 0);
	}

	// Set crystal ammo amount based on skill level
/*	if ((itemNum == ITM_AMMO_CRYSTAL_BORG) ||
		(itemNum == ITM_AMMO_CRYSTAL_DN) ||
		(itemNum == ITM_AMMO_CRYSTAL_FORGE) ||
		(itemNum == ITM_AMMO_CRYSTAL_SCAVENGER) ||
		(itemNum == ITM_AMMO_CRYSTAL_STASIS))
	{
		CrystalAmmoSettings(ent);
	}
*/
	ent->s.eType = ET_ITEM;
	ent->s.modelindex = ent->item - bg_itemlist;		// store item number in modelindex
	ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item

	ent->contents = CONTENTS_TRIGGER|CONTENTS_ITEM;//CONTENTS_BODY;//CONTENTS_TRIGGER|
	ent->e_TouchFunc = touchF_Touch_Item;
	// useing an item causes it to respawn
	ent->e_UseFunc = useF_Use_Item;
	ent->svFlags |= SVF_PLAYER_USABLE;//so player can pick it up

	// Hang in air?
	ent->s.origin[2] += 1;//just to get it off the damn ground because coplanar = insolid
	if ( (ent->spawnflags&ITMSF_SUSPEND)
		|| (ent->flags&FL_DROPPED_ITEM) )
	{
		// suspended
		G_SetOrigin( ent, ent->s.origin );
	}
	else
	{
		// drop to floor
		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], MIN_WORLD_COORD );
		gi.trace( &tr, ent->s.origin, ent->mins, ent->maxs, dest, ent->s.number, MASK_SOLID|CONTENTS_PLAYERCLIP, (EG2_Collision)0, 0 );
		if ( tr.startsolid )
		{
			if ( &g_entities[tr.entityNum] != NULL )
			{
				gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)\n", ent->classname, vtos(ent->s.origin), g_entities[tr.entityNum].classname );
			}
			else
			{
				gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)\n", ent->classname, vtos(ent->s.origin) );
			}
			assert( 0 && "item starting in solid");
			if (!g_entities[ENTITYNUM_WORLD].s.radius){	//not a region
				delayedShutDown = level.time + 100;
			}
			G_FreeEntity( ent );
			return;
		}

		// allow to ride movers
		ent->s.groundEntityNum = tr.entityNum;

		G_SetOrigin( ent, tr.endpos );
	}

/* ? don't need this
	// team slaves and targeted items aren't present at start
	if ( ( ent->flags & FL_TEAMSLAVE ) || ent->targetname ) {
		ent->s.eFlags |= EF_NODRAW;
		ent->contents = 0;
		return;
	}
*/
	if ( ent->spawnflags & ITMSF_INVISIBLE ) // invisible
	{
		ent->s.eFlags |= EF_NODRAW;
		ent->contents = 0;
	}

	if ( ent->spawnflags & ITMSF_NOTSOLID ) // not solid
	{
		ent->contents = 0;
	}

	if ( (ent->spawnflags&ITMSF_STATIONARY) )
	{//can't be pushed around
		ent->flags |= FL_NO_KNOCKBACK;
	}

	if ( (ent->flags&FL_DROPPED_ITEM) )
	{//go away after 30 seconds
		ent->e_ThinkFunc = thinkF_G_FreeEntity;
		ent->nextthink = level.time + 30000;
	}

	gi.linkentity (ent);
}
Exemple #6
0
/*
==================
Cmd_Where_f
==================
*/
void Cmd_Where_f( gentity_t *ent ) {
	trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", vtos(ent->r.currentOrigin) ) );
}
Exemple #7
0
gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) {
	trace_t		tr;
	vec3_t		dest;
	gentity_t	*ent;

	ent = G_Spawn();

	VectorCopy( origin, ent->s.origin );
	VectorCopy( origin, ent->s.pos.trBase );
	VectorCopy( origin, ent->r.currentOrigin );

	VectorSet( ent->r.mins, -15, -15, 0 );
	VectorSet( ent->r.maxs, 15, 15, 87 );

	ent->s.eType = ET_GENERAL;
	ent->flags = FL_NO_KNOCKBACK;

	if( g_gametype.integer == GT_OBELISK ) {
		ent->r.contents = CONTENTS_SOLID;
		ent->takedamage = qtrue;
		ent->health = g_obeliskHealth.integer;
		ent->die = ObeliskDie;
		ent->pain = ObeliskPain;
		ent->think = ObeliskRegen;
		ent->nextthink = level.time + g_obeliskRegenPeriod.integer * 1000;
	}
	if( g_gametype.integer == GT_HARVESTER ) {
		ent->r.contents = CONTENTS_TRIGGER;
		ent->touch = ObeliskTouch;
	}

	if ( spawnflags & 1 ) {
		// suspended
		G_SetOrigin( ent, ent->s.origin );
	} else {
		// mappers like to put them exactly on the floor, but being coplanar
		// will sometimes show up as starting in solid, so lif it up one pixel
		ent->s.origin[2] += 1;

		// drop to floor
		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );
		trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );
		if ( tr.startsolid ) {
			ent->s.origin[2] -= 1;
			G_Printf( "SpawnObelisk: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin) );

			ent->s.groundEntityNum = ENTITYNUM_NONE;
			G_SetOrigin( ent, ent->s.origin );
		}
		else {
			// allow to ride movers
			ent->s.groundEntityNum = tr.entityNum;
			G_SetOrigin( ent, tr.endpos );
		}
	}

	ent->spawnflags = team;

	trap_LinkEntity( ent );

	return ent;
}
Exemple #8
0
/*QUAKED dm_props_banner (.5 0 1) (-4 -4 -4) (4 4 4)
Temp banner for teamplay

 style = team (1 / 2)
 scale = scale the size up/down (2 = double size)

model="models\props\temp\triangle\small.md2"
*/
void SP_dm_props_banner (edict_t *self)
{
//	vec3_t	end, bestnorm, bestend;
//	float bestdist;
//	int	x,y;
//	trace_t tr;

	if (!deathmatch_value || !teamplay->value)
	{	// remove
		G_FreeEdict (self);
		return;
	}
	
	if (!self->style)
	{
		gi.dprintf( "%s has invalid style (should be 1 or 2) at %s\n", self->classname, vtos(self->s.origin) );
		G_FreeEdict (self);
		return;
	}
/*
	// trace a line back, to get the wall, then go out
	{
		bestdist = 9999;

		for (x=-256; x<300; x+= 256)
		{
			VectorCopy( self->s.origin, end );
			end[0] = self->s.origin[0] + x;
			tr = gi.trace( self->s.origin, NULL, NULL, end, NULL, MASK_SOLID );
			if (tr.fraction < bestdist)
			{
				VectorCopy( tr.plane.normal, bestnorm );
				VectorCopy( tr.endpos, bestend );
				bestdist = tr.fraction;
			}
		}
		for (y=-256; y<300; y+= 256)
		{
			VectorCopy( self->s.origin, end );
			end[1] = self->s.origin[1] + y;
			tr = gi.trace( self->s.origin, NULL, NULL, end, NULL, MASK_SOLID );
			if (tr.fraction < bestdist)
			{
				VectorCopy( tr.plane.normal, bestnorm );
				VectorCopy( tr.endpos, bestend );
				bestdist = tr.fraction;
			}
		}

		vectoangles( bestnorm, self->s.angles );

		VectorMA( bestend, 40 * self->cast_info.scale, bestnorm, self->s.origin );
	}

*/
// Ridah, 1-jun-99, use flag models for now
#if 1
	{
		void think_flag (edict_t *self);

//		self->solid = SOLID_BBOX;
		self->movetype = MOVETYPE_NONE;

		if (self->style == 2)
		{
			self->model = "models/props/flag/flag1.md2";
		}
		else
		{
			self->model = "models/props/flag/flag3.md2";
		}

		self->s.modelindex = gi.modelindex (self->model);

		self->s.renderfx2 |= RF2_NOSHADOW;
		self->s.renderfx |= RF_MINLIGHT;

		if (!self->cast_info.scale)
			self->cast_info.scale = 1;

		self->s.scale = (self->cast_info.scale - 1);

//		VectorMA( bestend, 40 * self->cast_info.scale, bestnorm, self->s.origin );

		self->cast_info.scale *= 0.3;

		gi.linkentity (self);

		self->s.effects |= EF_ANIM_ALLFAST_NEW;
		self->s.renderfx2 |= RF2_MODULUS_FRAME;
		self->s.renderfx2 |= RDF_NOLERP;

// Disabled, doesn't animate much, and uses bandwidth
//		self->nextthink = level.time + FRAMETIME *2;
//		self->think = think_flag;
	}

#else // TRIANGULAR ROTATING ICONS

	self->solid = SOLID_NOT;
	self->movetype = MOVETYPE_NONE;

	self->s.skinnum = self->style - 1;

	self->s.renderfx2 |= RF2_NOSHADOW;	
	self->s.renderfx |= RF_MINLIGHT;

	if (!self->cast_info.scale)
		self->cast_info.scale = 1;

	self->s.scale = self->cast_info.scale - 1;

	self->s.modelindex = gi.modelindex ("models/props/temp/triangle/small.md2");

	gi.linkentity (self);

	{
		edict_t *arm;

		arm = G_Spawn();
		arm->solid = self->solid;
		arm->movetype = self->movetype;
		arm->s.renderfx2 |= RF2_NOSHADOW;
		arm->s.scale = self->s.scale;

		VectorCopy( self->s.origin, arm->s.origin );
		VectorCopy( self->s.angles, arm->s.angles );

		arm->s.modelindex = gi.modelindex ("models/props/temp/triangle/arm.md2");
		gi.linkentity (arm);
	}

	VectorCopy( self->s.angles, self->last_step_pos );
	VectorClear( self->move_angles );
#endif
}
/*
===================
Svcmd_EntityShow_f
===================
*/
void Svcmd_EntityShow_f()
{
    int       entityNum;
    int       lastTargetIndex, targetIndex;
    gentity_t *selection;
    gentity_t *possibleTarget = nullptr;
    char argument[ 6 ];


    if (trap_Argc() != 2)
    {
        G_Printf("usage: entityShow <entityId>\n");
        return;
    }

    trap_Argv( 1, argument, sizeof( argument ) );
    entityNum = atoi( argument );

    if (entityNum >= level.num_entities || entityNum < MAX_CLIENTS)
    {
        G_Printf("entityId %d is out of range\n", entityNum);
        return;
    }

    selection = &g_entities[entityNum];

    if (!selection->inuse)
    {
        G_Printf("entity slot %d is unused/free\n", entityNum);
        return;
    }

    G_Printf( "⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼\n" );
    G_Printf( "^5#%3i^*: %16s", entityNum, Com_EntityTypeName( selection->s.eType ) );
    if (IS_NON_NULL_VEC3(selection->s.origin))
    {
        G_Printf("%26s", vtos( selection->s.origin ) );
    }
    G_Printf( "\n⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼\n" );
    G_Printf( "Classname: ^5%s^*\n", selection->classname );
    G_Printf( "Capabilities:%s%s%s%s%s%s%s\n\n",
              selection->act ? " acts" : "",
              selection->think ? " thinks" : "",
              selection->pain ? " pains" : "",
              selection->die ? " dies" : "",
              selection->reset ? " resets" : "",
              selection->touch ? " touchable" : "",
              selection->use ? " usable" : "");
    if (selection->names[0])
    {
        G_Printf( "Names: ");
        G_PrintEntityNameList( selection );
    }

    G_Printf("State: %s\n", selection->enabled ? "enabled" : "disabled");

    if (selection->groupName)
    {
        G_Printf("Member of Group: %s%s\n", selection->groupName, !selection->groupMaster ? " [master]" : "");
    }

    G_Printf( "\n");

    if(selection->targetCount)
    {
        G_Printf( "Aims at\n");

        while ((possibleTarget = G_IterateTargets(possibleTarget, &targetIndex, selection)) != nullptr )
        {
            G_Printf(" • %s %s\n", etos( possibleTarget ), vtos( possibleTarget->s.origin));
        }
        G_Printf( "\n");
    }

    if(selection->callTargetCount)
    {
        lastTargetIndex = -1;
        while ((possibleTarget = G_IterateCallEndpoints(possibleTarget, &targetIndex, selection)) != nullptr )
        {

            if(lastTargetIndex != targetIndex)
            {
                G_Printf("Calls %s \"%s:%s\"\n",
                         selection->calltargets[ targetIndex ].event ? selection->calltargets[ targetIndex ].event : "onUnknown",
                         selection->calltargets[ targetIndex ].name,
                         selection->calltargets[ targetIndex ].action ? selection->calltargets[ targetIndex ].action : "default");
                lastTargetIndex = targetIndex;
            }

            G_Printf(" • %s", etos(possibleTarget));
            if(possibleTarget->names[1])
            {
                G_Printf(" using \"%s\" ∈ ", selection->calltargets[ targetIndex ].name);
                G_PrintEntityNameList( possibleTarget );
            }
            G_Printf("\n");
        }
    }
    G_Printf( "\n" );
}
Exemple #10
0
BOOL CChangMaterilName::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CRect rect;
	int width = 0;

	//设置报表样式
	DWORD styles = m_workNameList.GetExtendedStyle();
	m_workNameList.SetExtendedStyle(styles|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);

	m_workNameList.GetWindowRect(rect);
	width = rect.right-rect.left;
    m_workNameList.InsertColumn( 0, "工程代号", LVCFMT_LEFT, width/3 );
    m_workNameList.InsertColumn( 1, "工程名称", LVCFMT_LEFT, width - width/3 );

	//设置报表样式
	styles = m_volumeIdList.GetExtendedStyle();
	m_volumeIdList.SetExtendedStyle(styles|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);

	m_volumeIdList.GetWindowRect(rect);
	width = rect.right-rect.left;
    m_volumeIdList.InsertColumn( 0, "卷册代号", LVCFMT_LEFT, width/3 );
    m_volumeIdList.InsertColumn( 1, "卷册名称", LVCFMT_LEFT, width - width/3 );

	//设置报表样式
	styles = m_materNameList.GetExtendedStyle();
	m_materNameList.SetExtendedStyle(styles|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);

	m_materNameList.GetWindowRect(rect);
	width = rect.right-rect.left;
    m_materNameList.InsertColumn( 0, "材料名称", LVCFMT_LEFT, width );
	_RecordsetPtr rsTmpEngin;
	HRESULT hr = S_OK;
	hr = rsTmpEngin.CreateInstance(__uuidof(Recordset));
	_variant_t vTmp;
	
	try
	{
		
		CString strSql = "SELECT EnginID,gcmc FROM Engin";
		
		rsTmpEngin->Open((_bstr_t)strSql,_variant_t((IDispatch*)EDIBgbl::dbPRJDB,true), 
			adOpenStatic, adLockOptimistic, adCmdText); 
		
		int i;
		CString strVal;
		
		m_workNameList.DeleteAllItems();
		while( !rsTmpEngin->adoEOF )
		{
			i = 0;
			rsTmpEngin->get_Collect((_variant_t)"EnginID", &vTmp);
			strVal = vtos(vTmp);
			m_workNameList.InsertItem(i,strVal);
			rsTmpEngin->get_Collect((_variant_t)"gcmc", &vTmp);
			strVal = vtos(vTmp);
			m_workNameList.SetItemText(i,1,strVal);
			rsTmpEngin->MoveNext();
			
			
			i++;
		}
		
	}
	catch(_com_error *e)
	{
	}

	if(rsTmpEngin->State == adStateOpen)
	{
		rsTmpEngin->Close();
	}
	rsTmpEngin.Release();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #11
0
void SP_misc_viper (edict_t *ent)
{
	if (!ent->target)
	{
		gi.dprintf ("misc_viper without a target at %s\n", vtos(ent->absmin));
		G_FreeEdict (ent);
		return;
	}

	if (ent->spawnflags & 1)
	{
		ent->s.effects |= EF_ROCKET;
		ent->spawnflags &= ~1; // turn this off so that it doesn't mess up the trains
	}

	if (!ent->speed)
		ent->speed = 300;

	ent->movetype = MOVETYPE_PUSH;

	if (ent->spawnflags & 2)
	{
		ent->solid = SOLID_BBOX;
	}
	else
	{
		ent->solid = SOLID_NOT;
	}

	if(ent->model)
	{
		ent->s.modelindex = gi.modelindex (ent->model);
	}
	else
	{
		ent->s.modelindex = gi.modelindex ("models/ships/viper/tris.md2");
	}

	if(ent->model2)
	{
		ent->s.modelindex2 = gi.modelindex (ent->model2);
	}

	if(ent->model3)
	{
		ent->s.modelindex3 = gi.modelindex (ent->model3);
	}

	if(ent->model4)
	{
		ent->s.modelindex4 = gi.modelindex (ent->model4);
	}

	if (!(ent->spawnflags & 4))
	{
		VectorSet (ent->mins, -16, -16, 0);
		VectorSet (ent->maxs, 16, 16, 32);
	}

	ent->think = func_train_find;
	ent->nextthink = level.time + FRAMETIME;
	ent->use = misc_viper_use;
	ent->svflags |= SVF_NOCLIENT;
	ent->moveinfo.accel = ent->moveinfo.decel = ent->moveinfo.speed = ent->speed;

	gi.linkentity (ent);
}
Exemple #12
0
void monster_start_go (edict_t *self)
{
	vec3_t	v;

	if (self->health <= 0)
	{
		if (self->max_health <= 0)
			InitiallyDead(self);
		return;
	}

	// Lazarus: move_origin for func_monitor
	if(!VectorLength(self->move_origin))
		VectorSet(self->move_origin,0,0,self->viewheight);

	// check for target to point_combat and change to combattarget
	if (self->target)
	{
		qboolean	notcombat;
		qboolean	fixup;
		edict_t		*target;

		target = NULL;
		notcombat = false;
		fixup = false;
		while ((target = G_Find (target, FOFS(targetname), self->target)) != NULL)
		{
			if (strcmp(target->classname, "point_combat") == 0)
			{
				self->combattarget = self->target;
				fixup = true;
			}
			else
			{
				notcombat = true;
			}
		}
		if (notcombat && self->combattarget)
			gi.dprintf("%s at %s has target with mixed types\n", self->classname, vtos(self->s.origin));
		if (fixup)
			self->target = NULL;
	}

	// validate combattarget
	if (self->combattarget)
	{
		edict_t		*target;

		target = NULL;
		while ((target = G_Find (target, FOFS(targetname), self->combattarget)) != NULL)
		{
			if (strcmp(target->classname, "point_combat") != 0)
			{
				gi.dprintf("%s at (%i %i %i) has a bad combattarget %s : %s at (%i %i %i)\n",
					self->classname, (int)self->s.origin[0], (int)self->s.origin[1], (int)self->s.origin[2],
					self->combattarget, target->classname, (int)target->s.origin[0], (int)target->s.origin[1],
					(int)target->s.origin[2]);
			}
		}
	}

	if (self->target)
	{
		self->goalentity = self->movetarget = G_PickTarget(self->target);
		if (!self->movetarget)
		{
			gi.dprintf ("%s can't find target %s at %s\n", self->classname, self->target, vtos(self->s.origin));
			self->target = NULL;
			self->monsterinfo.pausetime = 100000000;
			self->monsterinfo.stand (self);
		}
		else if (strcmp (self->movetarget->classname, "path_corner") == 0)
		{
			// Lazarus: Don't wipe out target for trigger spawned monsters
			//          that aren't triggered yet
			if( ! (self->spawnflags & SF_MONSTER_TRIGGER_SPAWN) ) {
				VectorSubtract (self->goalentity->s.origin, self->s.origin, v);
				self->ideal_yaw = self->s.angles[YAW] = vectoyaw(v);
				self->monsterinfo.walk (self);
				self->target = NULL;
			}
		}
		else
		{
			self->goalentity = self->movetarget = NULL;
			self->monsterinfo.pausetime = 100000000;
			self->monsterinfo.stand (self);
		}
	}
	else
	{
		self->monsterinfo.pausetime = 100000000;
		self->monsterinfo.stand (self);
	}

	self->think = monster_think;
	self->nextthink = level.time + FRAMETIME;
}
Exemple #13
0
qboolean monster_start (edict_t *self)
{
	if (deathmatch->value)
	{
		G_FreeEdict (self);
		return false;
	}

	// Lazarus: Already gibbed monsters passed across levels via trigger_transition:
	if ( (self->max_health > 0) && (self->health <= self->gib_health) && !(self->spawnflags & SF_MONSTER_NOGIB) )
	{
		void	SP_gibhead(edict_t *);

		SP_gibhead(self);
		return true;
	}

	// Lazarus: Good guys
	if (self->spawnflags & SF_MONSTER_GOODGUY) {
		self->monsterinfo.aiflags |= AI_GOOD_GUY;
		if(!self->dmgteam) {
			self->dmgteam = gi.TagMalloc(8*sizeof(char), TAG_LEVEL);
		//	strncpy(self->dmgteam,"player");
			Q_strncpyz(self->dmgteam,"player", 8);
		}
	}

	// Lazarus: Max range for sight/attack
	if(st.distance)
		self->monsterinfo.max_range = max(500,st.distance);
	else
		self->monsterinfo.max_range = 1280;	// Q2 default is 1000. We're mean.

	// Lazarus: We keep SIGHT to mean what old AMBUSH does, and AMBUSH additionally
	//          now means don't play idle sounds
/*	if ((self->spawnflags & MONSTER_SIGHT) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
	{
		self->spawnflags &= ~MONSTER_SIGHT;
		self->spawnflags |= MONSTER_AMBUSH;
	} */
	if ((self->spawnflags & SF_MONSTER_AMBUSH) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
		self->spawnflags |= SF_MONSTER_SIGHT;

	// Lazarus: Don't add trigger spawned monsters until they are actually spawned
	if (!(self->monsterinfo.aiflags & AI_GOOD_GUY) && !(self->spawnflags & SF_MONSTER_TRIGGER_SPAWN))
		level.total_monsters++;

	self->nextthink = level.time + FRAMETIME;
	self->svflags |= SVF_MONSTER;
	self->s.renderfx |= RF_FRAMELERP;
	self->air_finished = level.time + 12;
	self->use = monster_use;
	// Lazarus - don't reset max_health unnecessarily
	if(!self->max_health)
		self->max_health = self->health;
	if (self->health < (self->max_health / 2))
		self->s.skinnum |= 1;
	else
		self->s.skinnum &= ~1;
	self->clipmask = MASK_MONSTERSOLID;

	if (self->s.skinnum < 1) // Knightmare added
		self->s.skinnum = 0;
	self->deadflag = DEAD_NO;
	self->svflags &= ~SVF_DEADMONSTER;

	if(self->monsterinfo.flies > 1.0)
	{
		self->s.effects |= EF_FLIES;
		self->s.sound = gi.soundindex ("infantry/inflies1.wav");
	}

	// Lazarus
	if(self->health <=0)
	{
		self->svflags |= SVF_DEADMONSTER;
		self->movetype = MOVETYPE_TOSS;
		self->takedamage = DAMAGE_YES;
		self->monsterinfo.pausetime = 100000000;
		self->monsterinfo.aiflags &= ~AI_RESPAWN_FINDPLAYER;
		if(self->max_health > 0)
		{
			// This must be a dead monster who changed levels
			// via trigger_transition
			self->nextthink = 0;
			self->deadflag = DEAD_DEAD;
		}
		if(self->s.effects & EF_FLIES && self->monsterinfo.flies <= 1.0)
		{
			self->think = M_FliesOff;
			self->nextthink = level.time + 1 + random()*60;
		}
		return true;
	}
	else
	{
		// make sure red shell is turned off in case medic got confused:
		self->monsterinfo.aiflags &= ~AI_RESURRECTING;
		self->svflags &= ~SVF_DEADMONSTER;
		self->takedamage = DAMAGE_AIM;
	}

	if (!self->monsterinfo.checkattack)
		self->monsterinfo.checkattack = M_CheckAttack;
	VectorCopy (self->s.origin, self->s.old_origin);

	if (st.item)
	{
		self->item = FindItemByClassname (st.item);
		if (!self->item)
			gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item);
	}

	// randomize what frame they start on
	// Lazarus: preserve frame if set for monsters changing levels
	if (!self->s.frame)
	{
		if (self->monsterinfo.currentmove)
			self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1));
	}

	return true;
}
Exemple #14
0
void HintTestNext (edict_t *self, edict_t *hint)
{
	edict_t		*next=NULL;
	edict_t		*e;
	vec3_t		dir;

	self->monsterinfo.aiflags &= ~AI_HINT_TEST;
	if(self->goalentity == hint)
		self->goalentity = NULL;
	if(self->movetarget == hint)
		self->movetarget = NULL;
	if(self->monsterinfo.pathdir == 1)
	{
		if(hint->hint_chain)
			next = hint->hint_chain;
		else
			self->monsterinfo.pathdir = -1;
	}
	if(self->monsterinfo.pathdir == -1)
	{
		e = hint_chain_starts[hint->hint_chain_id];
		while(e)
		{
			if(e->hint_chain == hint)
			{
				next = e;
				break;
			}
			e = e->hint_chain;
		}
	}
	if(!next)
	{
		self->monsterinfo.pathdir = 1;
		next = hint->hint_chain;
	}
	if(next)
	{
		self->hint_chain_id = next->hint_chain_id;
		VectorSubtract(next->s.origin, self->s.origin, dir);
		self->ideal_yaw = vectoyaw(dir);
		self->goalentity = self->movetarget = next;
		self->monsterinfo.pausetime = 0;
		self->monsterinfo.aiflags = AI_HINT_TEST;
		// run for it
		self->monsterinfo.run (self);
		gi.dprintf("%s (%s): Reached hint_path %s,\nsearching for hint_path %s at %s. %s\n",
			self->classname, (self->targetname ? self->targetname : "<noname>"),
			(hint->targetname ? hint->targetname : "<noname>"),
			(next->targetname ? next->targetname : "<noname>"),
			vtos(next->s.origin),
			(visible(self,next) ? "I see it." : "I don't see it."));
	}
	else
	{
		self->monsterinfo.pausetime = level.time + 100000000;
		self->monsterinfo.stand (self);
		gi.dprintf("%s (%s): Error finding next/previous hint_path from %s at %s.\n",
			self->classname, (self->targetname ? self->targetname : "<noname>"),
			(hint->targetname ? hint->targetname : "<noname>"),
			vtos(hint->s.origin));
	}
}
/*
================
FinishSpawningItem

Traces down to find where an item should rest, instead of letting them
free fall from their spawn points
================
*/
void FinishSpawningItem( gentity_t *ent ) {
	trace_t		tr;
	vec3_t		dest;

	VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS );
	VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS );

	ent->s.eType = ET_ITEM;
	ent->s.modelindex = ent->item - bg_itemlist;		// store item number in modelindex
	ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item

	ent->r.contents = CONTENTS_TRIGGER;
	ent->touch = Touch_Item;
	// useing an item causes it to respawn
	ent->use = Use_Item;

	if ( ent->spawnflags & 1 ) {
		// suspended
		G_SetOrigin( ent, ent->s.origin );
	} else {
		// drop to floor
		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );
		trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );
		if ( tr.startsolid ) {
			G_Printf ("FinishSpawningItem: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
			G_FreeEntity( ent );
			return;
		}

		// allow to ride movers
		ent->s.groundEntityNum = tr.entityNum;

		G_SetOrigin( ent, tr.endpos );
	}

	// team slaves and targeted items aren't present at start
	if ( ( ent->flags & FL_TEAMSLAVE ) || ent->targetname ) {
		ent->s.eFlags |= EF_NODRAW;
		ent->r.contents = 0;
		return;
	}

	// powerups don't spawn in for a while
	if ( ent->item->giType == IT_POWERUP ) {
		float	respawn;

		respawn = 45 + crandom() * 15;
		ent->s.eFlags |= EF_NODRAW;
		ent->r.contents = 0;
		ent->nextthink = level.time + respawn * 1000;
		ent->think = RespawnItem;
		return;
	}

	if ( ent->item->giType == IT_HOLDABLE ) {
		if ( ( ent->item->giTag == HI_BAMBAM ) && ( g_gametype.integer != GT_CTF ) ) {
			return;
		}
		else if ( ( ent->item->giTag == HI_BOOMIES ) &&
		          ( ( g_gametype.integer != GT_CTF ) && ( g_gametype.integer != GT_BALLOON ) ) ) {
			return;
		}
	}


	trap_LinkEntity (ent);
}
Exemple #16
0
void SP_func_door_rotating (edict_t *ent)
{
	VectorClear (ent->s.angles);

	// set the axis of rotation
	VectorClear(ent->movedir);
	if (ent->spawnflags & DOOR_X_AXIS)
		ent->movedir[2] = 1.0;
	else if (ent->spawnflags & DOOR_Y_AXIS)
		ent->movedir[0] = 1.0;
	else // Z_AXIS
		ent->movedir[1] = 1.0;

	// check for reverse rotation
	if (ent->spawnflags & DOOR_REVERSE)
		VectorNegate (ent->movedir, ent->movedir);

	if (!st.distance)
	{
		gi.dprintf("%s at %s with no distance set\n", ent->classname, vtos(ent->s.origin));
		st.distance = 90;
	}

	VectorCopy (ent->s.angles, ent->pos1);
	VectorMA (ent->s.angles, st.distance, ent->movedir, ent->pos2);
	ent->moveinfo.distance = st.distance;

	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	gi.setmodel (ent, ent->model);

	ent->blocked = door_blocked;
	ent->use = door_use;

	if (!ent->speed)
		ent->speed = 100;
	if (!ent->accel)
		ent->accel = ent->speed;
	if (!ent->decel)
		ent->decel = ent->speed;

	if (!ent->wait)
		ent->wait = 3;
	if (!ent->dmg)
		ent->dmg = 2;

	if (ent->sounds != 1)
	{
		ent->moveinfo.sound_start = gi.soundindex  ("doors/dr1_strt.wav");
		ent->moveinfo.sound_middle = gi.soundindex  ("doors/dr1_mid.wav");
		ent->moveinfo.sound_end = gi.soundindex  ("doors/dr1_end.wav");
	}

	// if it starts open, switch the positions
	if (ent->spawnflags & DOOR_START_OPEN)
	{
		VectorCopy (ent->pos2, ent->s.angles);
		VectorCopy (ent->pos1, ent->pos2);
		VectorCopy (ent->s.angles, ent->pos1);
		VectorNegate (ent->movedir, ent->movedir);
	}

	if (ent->health)
	{
		ent->takedamage = DAMAGE_YES;
		ent->die = door_killed;
		ent->max_health = ent->health;
	}
	
	if (ent->targetname && ent->message)
	{
		gi.soundindex ("misc/talk.wav");
		ent->touch = door_touch;
	}

	ent->moveinfo.state = STATE_BOTTOM;
	ent->moveinfo.speed = ent->speed;
	ent->moveinfo.accel = ent->accel;
	ent->moveinfo.decel = ent->decel;
	ent->moveinfo.wait = ent->wait;
	VectorCopy (ent->s.origin, ent->moveinfo.start_origin);
	VectorCopy (ent->pos1, ent->moveinfo.start_angles);
	VectorCopy (ent->s.origin, ent->moveinfo.end_origin);
	VectorCopy (ent->pos2, ent->moveinfo.end_angles);

	if (ent->spawnflags & 16)
		ent->s.effects |= EF_ANIM_ALL;

	// to simplify logic elsewhere, make non-teamed doors into a team of one
	if (!ent->team)
		ent->teammaster = ent;

	gi.linkentity (ent);

	ent->nextthink = level.time + FRAMETIME;
	if (ent->health || ent->targetname)
		ent->think = Think_CalcMoveSpeed;
	else
		ent->think = Think_SpawnDoorTrigger;
}
Exemple #17
0
void CFrmPreferences::OnOK() 
{
	// TODO: Add extra validation here
	bool FLAG = modPHScal::gbSPRBHLOADUNITBYNEWTON; //保存

	m_wndCalPag.SaveIniValue();
	m_wndDrawPag.SaveIniValue();
	m_wndPointPag.SaveIniValue();
	if(m_wndStylePag.GetActiveTimes() > 1)
	{
		m_wndStylePag.SaveIniValue();
	}
	SetRegValue(_T("Settings"), _T("CSPRAutoLugDia"), modPHScal::gbCSPRAutoLugDia);
	SetRegValue(_T("Settings"), _T("AutoTZ"), modPHScal::AutoOrdinateDrawing);


	SetRegValue(_T("Settings"), _T("CalSAbyConservativenessMethod"), (modPHScal::gbCalSAbyConservativenessMethod));
	SetRegValue(_T("Settings"), _T("CalSAbyPJG"), (modPHScal::gbCalSAbyPJG));
	SetRegValue(_T("Settings"), _T("CalCSPRLugDiaByPjg"), (modPHScal::gbCalCSPRLugDiaByPjg));

	SetRegValue(_T("Settings"), _T("CalPARTbyMaxLoad"), (modPHScal::gbCalPARTbyMaxLoad));
	SetRegValue(_T("Settings"), _T("AddPartWeight2PMax"), (modPHScal::gbAddPartWeight2PMax));
	SetRegValue(_T("Settings"), _T("AddPartWeight2CSPRPgz"), (modPHScal::gbAddPartWeight2CSPRPgz));
	SetRegValue(_T("Settings"), _T("AddPartWeight2SPRPgz"),  (modPHScal::gbAddPartWeight2SPRPgz));//2007.07.30
	SetRegValue(_T("Settings"),_T("PAForceZero"),(modPHScal::gbPAForceZero));//2007.09.25
	SetRegValue(_T("Settings"), _T("MaxPgzPaz"),  (modPHScal::gbMaxPgzPaz));//2007.09.03
	SetRegValue(_T("Settings"), _T("MinMaxDispByActualDisp"), (modPHScal::gbMinMaxDispByActualDisp));


	SetRegValue(_T("Settings"), _T("PhsOutINFOTableType"), (modPHScal::giPhsOutINFOTableType));
	SetRegValue(_T("Settings"), _T("DrawSIZE_A3A4"), (modPHScal::giDrawSIZE_A3A4));
	SetRegValue(_T("Settings"), _T("IsACAD"), (modPHScal::gIsACAD));
	SetRegValue(_T("Settings"), _T("SpringOrder"), (modPHScal::giSpringOrder));
	SetRegValue(_T("Settings"), _T("strSpringOrder"), modPHScal::gstrSpringOrder);
	SetRegValue(_T("Settings"), _T("strSpringOrderSQL"), modPHScal::gstrSpringOrderSQL);
	SetRegValue(_T("Settings"), _T("PhsColor"), modPHScal::gsPhsColor);
	SetRegValue(_T("Settings"), _T("Draw_BOM"), (modPHScal::gbDraw_BOM));
	SetRegValue(_T("Settings"), _T("AnnotateCSPR"), (modPHScal::gbAnnotateCSPR));
	SetRegValue(_T("Settings"), _T("Draw_OVERWRITE"), (modPHScal::gbDrawOVERWRITE));
	SetRegValue(_T("Settings"), _T("WorksWithBoltsNuts"), (modPHScal::gbWorksWithBoltsNuts));
	SetRegValue(_T("Settings"), _T("WorksWithSABoltsNuts"), (modPHScal::gbWorksWithSABoltsNuts));
	SetRegValue(_T("Settings"), _T("DW_delta"), (modPHScal::gnDW_delta));

	SetRegValue(_T("Settings"), _T("ZDJH"), (EDIBgbl::glCurRecordNo));
	SetRegValue(_T("Settings"), _T("DrawNoPreMethod"), (modPHScal::gbDrawNoPreMethod));
	SetRegValue(_T("Settings"), _T("AutoSaveDrawing"), (modPHScal::gbAutoSaveDrawing));
	SetRegValue(_T("Settings"), _T("DrawNoStartNumber"), (modPHScal::glDrawNoStartNumber));
	SetRegValue(_T("Settings"), _T("DwgVersion"), (EDIBgbl::strDwgVersion));
	SetRegValue(_T("Settings"), _T("MaxLGLong"), (EDIBgbl::MaxLGLong));//pfg20050922

	SetRegValue(_T("Settings"), _T("DWGPreMethod"), (modPHScal::glDWGPreMethod));
	SetRegValue(_T("Settings"), _T("DWGPre"), modPHScal::gsDWGPre);
	SetRegValue(_T("Settings"), _T("CSPRCanSpecialDesign"), (modPHScal::gbCSPRCanSpecialDesign));
	SetRegValue(_T("Settings"), _T("LimitLugMinDia"), (modPHScal::gbLimitLugMinDia));

	SetRegValue(_T("Settings"), _T("AutoAlignCSPRtoSA"), (modPHScal::gbAutoAlignCSPRtoSA));
	SetRegValue(_T("Settings"), _T("SumAllVolume"), (modPHScal::gbSumAllVolume));

	
	////////////////////////////
	if(FLAG!=modPHScal::gbSPRBHLOADUNITBYNEWTON)//单位改变时要初始化 
	{									   
		//this->ShowWindow(SW_HIDE);
		//modPHScal::blnSelphsSPEC(true);

		
		_variant_t tmpvar;
		int inttbExist=0;//0表示第一次进入循环,1表示表存在,2表示表不存在
		_RecordsetPtr rsX;
		rsX.CreateInstance(__uuidof(Recordset));
		_ConnectionPtr db, db1;
		db.CreateInstance(__uuidof(Connection));
		db1.CreateInstance(__uuidof(Connection));

		long  lngErrNum ;
		CString sTmp;

		CString strConnect;
		strConnect.Format(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Jet OLEDB:Database Password=%s"),
			basDirectory::DBShareDir + _T("zdjcrude.mdb"), ModEncrypt::gstrDBZdjCrudePassWord);
		db->Open((_bstr_t)strConnect, "", "", adModeUnknown);

		db1->Open((_bstr_t)("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+basDirectory::ProjectDBDir+_T("sort.mdb")),
			(_bstr_t)"", (_bstr_t)"",adModeUnknown);

		if(rsX->State == adStateOpen)
			rsX->Close();
		rsX->Open((_bstr_t)_T("SELECT * FROM phsManuSPRING ORDER BY [Observation],[standard] ASC"), 
			_variant_t((IDispatch*)EDIBgbl::dbSORT,true), 
			adOpenDynamic, adLockOptimistic, adCmdText); 
		modPHScal::gsPhsSPRINGSel.TrimLeft();modPHScal::gsPhsSPRINGSel.TrimRight(); 
		if( rsX->adoEOF && rsX->BOF )
		{
			lngErrNum = IDS_NotFoundThisStandardInSortMdb;
			sTmp.Format(GetResStr(lngErrNum),EDIBgbl::GetDBName(db1),_T("phsManuBoltsNuts"),modPHScal::gsPhsBoltsNutsSel);
			ShowMessage(sTmp);
			if(rsX->State == adStateOpen)
				rsX->Close();
			
			if(db->State == adStateOpen)
				db->Close();
			
			if(db1->State == adStateOpen)
				db1->Close();
			CPropertySheet::EndDialog(IDOK);
		}
		if(modPHScal::gsPhsSPRINGSel != _T("") ){
			// rsX->Filter=_variant_t(CString(_T("standard=\'") )+ gsPhsPASel + _T("\'"));
			//rsX.FindFirst
			//rsX->Find(_bstr_t(CString(_T("standard=\'"))+gsPhsSPRINGSel+_T("\'")),0,adSearchForward);
			HRESULT hr = S_OK;
			CString strFind;
			strFind = _T("standard=\'")+modPHScal::gsPhsSPRINGSel+_T("\'");
			hr = rsX->Find((_bstr_t)strFind, 0, adSearchForward);
			if( !rsX->adoEOF)	   
			{
				rsX->MoveFirst();
				inttbExist=2;
			}
		}
		else
		{
			rsX->MoveFirst();
			inttbExist=2;
		}
		while((inttbExist!=1)&&(!rsX->adoEOF))
		{
			rsX->get_Collect((_variant_t)_T("standard"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::gsPhsSPRINGSel=_T("");
			else{
				modPHScal::gsPhsSPRINGSel=vtos(tmpvar);
				modPHScal::gsPhsSPRINGSel.TrimLeft();modPHScal::gsPhsSPRINGSel.TrimRight();
			}
			rsX->get_Collect((_variant_t)_T("Spring_property"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::tbnSPRINGproperty=_T("");
			else{
				modPHScal::tbnSPRINGproperty=vtos(tmpvar);
				modPHScal::tbnSPRINGproperty.TrimLeft();modPHScal::tbnSPRINGproperty.TrimRight();
			}
			rsX->get_Collect((_variant_t)_T("Spring_propertyMaxDist"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::tbnDiscSPRINGpropertyMaxDist=_T("");
			else{
				modPHScal::tbnDiscSPRINGpropertyMaxDist=vtos(tmpvar);
				modPHScal::tbnDiscSPRINGpropertyMaxDist.TrimLeft();modPHScal::tbnDiscSPRINGpropertyMaxDist.TrimRight();
			}
			rsX->get_Collect((_variant_t)_T("Spring_id"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::tbnSPRINGid=_T("");
			else{
				modPHScal::tbnSPRINGid=vtos(tmpvar);
				modPHScal::tbnSPRINGid.TrimLeft();modPHScal::tbnSPRINGid.TrimRight();
			}
			rsX->get_Collect((_variant_t)_T("Spring_Crude"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::tbnSPRINGCrude=_T("");
			else{
				modPHScal::tbnSPRINGCrude=vtos(tmpvar);
				modPHScal::tbnSPRINGCrude.TrimLeft();modPHScal::tbnSPRINGCrude.TrimRight();
			}
			rsX->get_Collect((_variant_t)_T("CrudeTurnbuckle"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::tbnSPRINGL5Crude=_T("");
			else{
				modPHScal::tbnSPRINGL5Crude=vtos(tmpvar);
				modPHScal::tbnSPRINGL5Crude.TrimLeft();modPHScal::tbnSPRINGL5Crude.TrimRight();
			}
			//以下判断弹簧原始数据表在数据库中是否存在
			rsX->get_Collect((_variant_t)_T("DiameterSerial"),&tmpvar);
			if(tmpvar.vt==VT_NULL)
				modPHScal::tbnSPRDiameterSerial=_T("");
			else{
				modPHScal::tbnSPRDiameterSerial=vtos(tmpvar);
				modPHScal::tbnSPRDiameterSerial.TrimLeft();modPHScal::tbnSPRDiameterSerial.TrimRight();
			}
			if(!modPHScal::HStbExists(db,db1,modPHScal::tbnSPRDiameterSerial,_T("phsManuSPRING"),_T("DiameterSerial"),modPHScal::gsPhsSPRINGSel))
			{	
				if(inttbExist==0)	//第一次移到第一条记录上
				{
					rsX->MoveFirst();
					inttbExist=2;
				}
				else					//不是第一次,向后移一条记录
					rsX->MoveNext();
				continue;
			}
			if(!modPHScal::HStbExists(db,db1,modPHScal::tbnSPRINGCrude,_T("phsManuSPRING"),_T("Spring_Crude"),modPHScal::gsPhsSPRINGSel))
			{	
				if(inttbExist==0)	//第一次移到第一条记录上
				{
					rsX->MoveFirst();
					inttbExist=2;
				}
				else					//不是第一次,向后移一条记录
					rsX->MoveNext();
				continue;
			}
			if(!modPHScal::HStbExists(db,db1,modPHScal::tbnSPRINGL5Crude,_T("phsManuSPRING"),_T("CrudeTurnbuckle"),modPHScal::gsPhsSPRINGSel))
			{	
				if(inttbExist==0)	//第一次移到第一条记录上
				{
					rsX->MoveFirst();
					inttbExist=2;
				}
				else					//不是第一次,向后移一条记录
					rsX->MoveNext();
				continue;
			}
			if(!modPHScal::HStbExists(db,db1,modPHScal::tbnSPRINGid,_T("phsManuSPRING"),_T("Spring_id"),modPHScal::gsPhsSPRINGSel))
			{	
				if(inttbExist==0)	//第一次移到第一条记录上
				{
					rsX->MoveFirst();
					inttbExist=2;
				}
				else					//不是第一次,向后移一条记录
					rsX->MoveNext();
				continue;
			}
			if(!modPHScal::HStbExists(db,db1,modPHScal::tbnSPRINGproperty,_T("phsManuSPRING"),_T("Spring_property"),modPHScal::gsPhsSPRINGSel))
			{	
				if(inttbExist==0)	//第一次移到第一条记录上
				{
					rsX->MoveFirst();
					inttbExist=2;
				}
				else					//不是第一次,向后移一条记录
					rsX->MoveNext();
				continue;
			}
			if(!modPHScal::HStbExists(db,db1,modPHScal::tbnDiscSPRINGpropertyMaxDist,_T("phsManuSPRING"),_T("Spring_propertyMaxDist"),modPHScal::gsPhsSPRINGSel))
			{	
				if(inttbExist==0)	//第一次移到第一条记录上
				{
					rsX->MoveFirst();
					inttbExist=2;
				}
				else					//不是第一次,向后移一条记录
					rsX->MoveNext();
				continue;
			}
			inttbExist=1;
	}
	if(inttbExist!=1)
	{
		if(rsX->State == adStateOpen)
			rsX->Close();
		
		if(db->State == adStateOpen)
			db->Close();
		
		if(db1->State == adStateOpen)
			db1->Close();
		CPropertySheet::EndDialog(IDOK);
	}
	inttbExist=0;
	   rsX->get_Collect((_variant_t)_T("SerialNumPerSPR"),&tmpvar);
	   if(tmpvar.vt==VT_NULL)
		   modPHScal::giAllowedMaxSerialNumPerSPR=0;
	   else{
		   modPHScal::giAllowedMaxSerialNumPerSPR=vtoi(tmpvar);
		   //   giAllowedMaxSerialNumPerSPR.TrimLeft();giAllowedMaxSerialNumPerSPR.TrimRight();
	   }
	   rsX->get_Collect((_variant_t)_T("SerialNumSPRs"),&tmpvar);
	   if(tmpvar.vt==VT_NULL)
		   modPHScal::giAllowedMaxSerialNumSPRs=0;
	   else{
		   modPHScal::giAllowedMaxSerialNumSPRs=vtoi(tmpvar);
		   //giAllowedMaxSerialNumSPRs.TrimLeft();giAllowedMaxSerialNumSPRs.TrimRight();
	   }
	   //当导入了规范或者启动过之后
		bool	 bSPECchanged = true;
	   if((bSPECchanged || modPHScal::gbStartedOnceAPHS) && !(modPHScal::gsPhsSPRINGSel == modPHScal::gsOldPhsSPRINGSel))
		   modPHScal::CreateTmpSPRPropertyTable(modPHScal::giAllowedMaxSerialNumSPRs);
	   //获得弹簧或恒力弹簧编号规格的单位制
	   //以下判断恒力弹簧/碟簧规格编号力单位制描述字段值是否存在
	   rsX->get_Collect((_variant_t)_T("Unit_Force"),&tmpvar);
	   if(tmpvar.vt==VT_NULL)
	   {
		   lngErrNum = IDS_NullXfieldInphsManuXOfsortMdb;
		   sTmp.Format(GetResStr(lngErrNum),EDIBgbl::GetDBName(db1),_T("phsManuSPRING"),modPHScal::gsPhsSPRINGSel ,_T("Unit_Force"));
		   ShowMessage(sTmp);
		   if(rsX->State == adStateOpen)
			   rsX->Close();
		   
		   if(db->State == adStateOpen)
			   db->Close();
		   
		   if(db1->State == adStateOpen)
			   db1->Close();
		   CPropertySheet::EndDialog(IDOK);
	   }
	   else{
		   sTmp=vtos(tmpvar);
		   sTmp.TrimLeft();sTmp.TrimRight();
		   if(sTmp.Left(1)==_T("N"))
		   {
			   if(!modPHScal::gbSPRBHLOADUNITBYNEWTON)
			   {
				   modPHScal::gsSPRUnitOfLoad = _T("kgf");
				   rsX->put_Collect((_variant_t)_T("Unit_Force"),STR_VAR("kgf"));
				   rsX->Update();
				   //如果没有导入,只修改模板库下的原始数据库;
				   //修改方法:
				   rsX->get_Collect((_variant_t)_T("Folder"), &tmpvar);
				   
				   if(tmpvar.vt==VT_NULL||vtos(tmpvar)=="")
					   ;
				   else
				   {
					   //如果有导入,还要修改导入路径下的原始数据库;
				   }
			   }
			   else
			   {
				   modPHScal::gsSPRUnitOfLoad = _T("N");
			   }
			   
			   // gsSPRUnitOfLoad = _T("N");
		   }
		   else if(sTmp.Left(3)==_T("daN"))
			   modPHScal::gsSPRUnitOfLoad = _T("daN");
		   else if(sTmp.Left(3)==_T("kgf"))
		   {
			   if(modPHScal::gbSPRBHLOADUNITBYNEWTON)
			   {
				   modPHScal::gsSPRUnitOfLoad = _T("N");
				   rsX->put_Collect((_variant_t)_T("Unit_Force"),STR_VAR("N"));
				   rsX->Update();
				   //如果没有导入,只修改模板库下的原始数据库;
				   //修改方法:
				   rsX->get_Collect((_variant_t)_T("Folder"),&tmpvar);
				   
				   if(tmpvar.vt==VT_NULL||vtos(tmpvar)=="")
					   ;
				   else
				   {
					   //如果有导入,还要修改导入路径下的原始数据库;
				   }
			   }
			   else
			   {
				   modPHScal::gsSPRUnitOfLoad = _T("kgf");
			   }
		   }
		   else
			   //没找任何荷载单位制识别字符
		   {
			   sTmp.Format(GetResStr(IDS_NotFoundUnitStringInBHFormat),EDIBgbl::GetDBName(db1),_T("phsManuSPRING"),GetResStr(IDS_SPR),vtos(tmpvar));
		   ShowMessage(sTmp);
		   modPHScal::gsSPRUnitOfLoad = _T("daN");
		   }
	   }
	}

	CPropertySheet::EndDialog(IDOK);
}
Exemple #18
0
void FinishSpawningItem( gentity_t *ent ) {
	trace_t		tr;
	vec3_t		dest;
	gitem_t		*item;
	int			itemNum;

	itemNum=1;
	for ( item = bg_itemlist + 1 ; item->classname ; item++,itemNum++) 
	{
		if (!strcmp(item->classname,ent->classname))
		{
			break;
		}
	}

	// Set bounding box for item
	VectorSet( ent->mins, item->mins[0],item->mins[1] ,item->mins[2]);
	VectorSet( ent->maxs, item->maxs[0],item->maxs[1] ,item->maxs[2]);

	if ((!ent->mins[0] && !ent->mins[1] && !ent->mins[2]) && 
		(!ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2]))
	{
		VectorSet (ent->mins, -ITEM_RADIUS, -ITEM_RADIUS, -2);//to match the comments in the items.dat file!
		VectorSet (ent->maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);
	}

	if ((item->quantity) && (item->giType == IT_AMMO))
	{
		ent->count = item->quantity;
	}

	if ((item->quantity) && (item->giType == IT_BATTERY))
	{
		ent->count = item->quantity; 
	}


//	if ( item->giType == IT_WEAPON ) // NOTE: james thought it was ok to just always do this?
	{
		ent->s.radius = 20;
		VectorSet( ent->s.modelScale, 1.0f, 1.0f, 1.0f );
		gi.G2API_InitGhoul2Model( ent->ghoul2, ent->item->world_model, G_ModelIndex( ent->item->world_model ), NULL, NULL, 0, 0);
	}

	// Set crystal ammo amount based on skill level
/*	if ((itemNum == ITM_AMMO_CRYSTAL_BORG) ||
		(itemNum == ITM_AMMO_CRYSTAL_DN) ||
		(itemNum == ITM_AMMO_CRYSTAL_FORGE) ||
		(itemNum == ITM_AMMO_CRYSTAL_SCAVENGER) ||
		(itemNum == ITM_AMMO_CRYSTAL_STASIS))
	{
		CrystalAmmoSettings(ent);
	}
*/
	ent->s.eType = ET_ITEM;
	ent->s.modelindex = ent->item - bg_itemlist;		// store item number in modelindex
	ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item

	ent->contents = CONTENTS_TRIGGER|CONTENTS_ITEM;//CONTENTS_BODY;//CONTENTS_TRIGGER|
	ent->e_TouchFunc = touchF_Touch_Item;
	// useing an item causes it to respawn
	ent->e_UseFunc = useF_Use_Item;
	ent->svFlags |= SVF_PLAYER_USABLE;//so player can pick it up

	// Hang in air?
	ent->s.origin[2] += 1;//just to get it off the damn ground because coplanar = insolid
	if ( ent->spawnflags & ITMSF_SUSPEND) 
	{
		// suspended
		G_SetOrigin( ent, ent->s.origin );
	} 
	else 
	{
		// drop to floor
		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], MIN_WORLD_COORD );
		gi.trace( &tr, ent->s.origin, ent->mins, ent->maxs, dest, ent->s.number, MASK_SOLID|CONTENTS_PLAYERCLIP, G2_NOCOLLIDE, 0 );
		if ( tr.startsolid ) 
		{
			if ( &g_entities[tr.entityNum] != NULL )
			{
				gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)\n", ent->classname, vtos(ent->s.origin), g_entities[tr.entityNum].classname );
			}
			else
			{
				gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)\n", ent->classname, vtos(ent->s.origin) );
			}
			assert( 0 && "item starting in solid");
#ifndef FINAL_BUILD
			if (!g_entities[ENTITYNUM_WORLD].s.radius){	//not a region
				delayedShutDown = level.time + 100;
			}
#endif
			G_FreeEntity( ent );
			return;
		}

		// allow to ride movers
		ent->s.groundEntityNum = tr.entityNum;

		G_SetOrigin( ent, tr.endpos );
	}

/* ? don't need this
	// team slaves and targeted items aren't present at start
	if ( ( ent->flags & FL_TEAMSLAVE ) || ent->targetname ) {
		ent->s.eFlags |= EF_NODRAW;
		ent->contents = 0;
		return;
	}
*/
	if ( ent->spawnflags & ITMSF_INVISIBLE ) // invisible
	{
		ent->s.eFlags |= EF_NODRAW;
		ent->contents = 0;
	}

	if ( ent->spawnflags & ITMSF_NOTSOLID ) // not solid
	{
		ent->contents = 0;
	}

	gi.linkentity (ent);
}
/*QUAKED func_tramcar (0 .5 .8) ? START_ON TOGGLE - LEADER
health value of 999 will designate the piece as non damageable

The leader of the tramcar group must have the leader flag set or
you'll end up with co-planer poly heaven. When the health of the Leader
of the team hits zero it will unlink and the team will become visible

A tramcar is a mover that moves between path_corner target points.
all tramcar parts MUST HAVE AN ORIGIN BRUSH. (this is true for all parts)

The tramcar spawns at the first target it is pointing at.

If you are going to have enemies ride the tramcar it must be placed in its ending
position when you bsp the map you can the start it by targeting the desired path_corner

"model2"	.md3 model to also draw
"speed"		default 100
"dmg"		default	2
"noise"		looping sound to play when the train is in motion
"target"	next path corner
"color"		constantLight color
"light"		constantLight radius

"type" type of debris ("glass", "wood", "metal", "gibs") default is "wood"
"mass" defaults to 75.  This determines how much debris is emitted when it explodes.  You get one large chunk per 100 of mass (up to 8) and one small chunk per 25 of mass (up to 16).  So 800 gives the most.
*/
void SP_func_tramcar( gentity_t *self ) {

	int mass;
	char    *type;
	char    *s;
	char buffer[MAX_QPATH];

	VectorClear( self->s.angles );

	//if (self->spawnflags & TRAMCAR_BLOCK_STOPS) {
	//	self->damage = 0;
	//	self->s.eFlags |= EF_MOVER_STOP;
	//}
	//else {
	if ( !self->damage ) {
		self->damage = 100;
	}
	//}

	if ( !self->speed ) {
		self->speed = 100;
	}

	if ( !self->target ) {
		G_Printf( "func_tramcar without a target at %s\n", vtos( self->r.absmin ) );
		G_FreeEntity( self );
		return;
	}

	if ( self->spawnflags & TRAMCAR_LEADER ) {
		if ( !self->health ) {
			self->health = 50;
		}

		self->takedamage = qtrue;
		self->die = Tramcar_die;

		if ( self->health < 999 ) {
			self->isProp = qtrue;
		}
	}

	trap_SetBrushModel( self, self->model );

	if ( G_SpawnInt( "mass", "75", &mass ) ) {
		self->count = mass;
	} else {
		self->count = 75;
	}

	G_SpawnString( "type", "wood", &type );
	if ( !Q_stricmp( type,"wood" ) ) {
		self->key = 0;
	} else if ( !Q_stricmp( type,"glass" ) )   {
		self->key = 1;
	} else if ( !Q_stricmp( type,"metal" ) )                                                            {
		self->key = 2;
	} else if ( !Q_stricmp( type,"gibs" ) )                                                                                                                     {
		self->key = 3;
	}

	if ( G_SpawnString( "noise", "NOSOUND", &s ) ) {
		if ( Q_stricmp( s, "nosound" ) ) {
			Q_strncpyz( buffer, s, sizeof( buffer ) );
			self->s.dl_intensity = G_SoundIndex( buffer );
		}
	} else {
		switch ( self->key )
		{
		case 0:     // "wood"
			self->s.dl_intensity = G_SoundIndex( "sound/world/boardbreak.wav" );
			break;
		case 1:     // "glass"
			self->s.dl_intensity = G_SoundIndex( "sound/world/glassbreak.wav" );
			break;
		case 2:     // "metal"
			self->s.dl_intensity = G_SoundIndex( "sound/world/metalbreak.wav" );
			break;
		case 3:     // "gibs"
			self->s.dl_intensity = G_SoundIndex( "sound/player/gibsplit1.wav" );
			break;
		}
	}

	self->s.density = self->count;  // pass the "mass" to the client

	InitTramcar( self );

	self->reached = Reached_Tramcar;

	self->nextthink = level.time + ( FRAMETIME / 2 );

	self->think = Think_SetupTrainTargets;

	self->blocked = Blocked_Tramcar;

	if ( self->spawnflags & TRAMCAR_TOGGLE ) {
		self->use = TramCarUse;
	}

}
Exemple #20
0
void target_laser_start (edict_t *self)
{
        edict_t *ent;

        self->movetype = MOVETYPE_NONE;
        self->solid = SOLID_NOT;
        self->s.renderfx |= RF_BEAM|RF_TRANSLUCENT;
        self->s.modelindex = 1;                 // must be non-zero

        // set the beam diameter
        if (self->spawnflags & 64)
                self->s.frame = 16;
        else
                self->s.frame = 4;

        // set the color
        if (self->spawnflags & 2)
                self->s.skinnum = 0xf2f2f0f0;
        else if (self->spawnflags & 4)
                self->s.skinnum = 0xd0d1d2d3;
        else if (self->spawnflags & 8)
                self->s.skinnum = 0xf3f3f1f1;
        else if (self->spawnflags & 16)
                self->s.skinnum = 0xdcdddedf;
        else if (self->spawnflags & 32)
                self->s.skinnum = 0xe0e1e2e3;

        if (!self->enemy)
        {
                if (self->target)
                {
                        ent = G_Find (NULL, FOFS(targetname), self->target);
                        if (!ent)
                                gi.dprintf ("%s at %s: %s is a bad target\n", self->classname, vtos(self->s.origin), self->target);
                        self->enemy = ent;
                }
                else
                {
                        G_SetMovedir (self->s.angles, self->movedir);
                }
        }
        self->use = target_laser_use;
        self->think = target_laser_think;

        if (!self->dmg)
                self->dmg = 1;

        VectorSet (self->mins, -8, -8, -8);
        VectorSet (self->maxs, 8, 8, 8);
        gi.linkentity (self);

        if (self->spawnflags & 1)
                target_laser_on (self);
        else
                target_laser_off (self);
}
Exemple #21
0
/**
* @brief Traces down to find where an item should rest, instead of letting them
*        free fall from their spawn points.
*/
void FinishSpawningItem(gentity_t *ent)
{
	trace_t tr;
	vec3_t  dest;
	vec3_t  maxs;

	if (ent->spawnflags & 1)     // suspended
	{
		VectorSet(ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS);
		VectorSet(ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);
		VectorCopy(ent->r.maxs, maxs);
	}
	else
	{
		// had to modify this so that items would spawn in shelves
		VectorSet(ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, 0);
		VectorSet(ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);
		VectorCopy(ent->r.maxs, maxs);
		maxs[2] /= 2;
	}

	ent->r.contents   = CONTENTS_TRIGGER | CONTENTS_ITEM;
	ent->touch        = Touch_Item_Auto;
	ent->s.eType      = ET_ITEM;
	ent->s.modelindex = ent->item - bg_itemlist;        // store item number in modelindex

	ent->s.otherEntityNum2 = 0;     // takes modelindex2's place in signaling a dropped item
	// we don't use this (yet, anyway) so I'm taking it so you can specify a model for treasure items and clipboards
	//ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item
	if (ent->model)
	{
		ent->s.modelindex2 = G_ModelIndex(ent->model);
	}

	// using an item causes it to respawn
	ent->use = Use_Item;

	// moved this up so it happens for suspended items too (and made it a function)
	G_SetAngle(ent, ent->s.angles);

	if (ent->spawnflags & 1)        // suspended
	{
		G_SetOrigin(ent, ent->s.origin);
	}
	else
	{
		VectorSet(dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096);
		trap_Trace(&tr, ent->s.origin, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID);

		if (tr.startsolid)
		{
			vec3_t temp;

			VectorCopy(ent->s.origin, temp);
			temp[2] -= ITEM_RADIUS;

			VectorSet(dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096);
			trap_Trace(&tr, temp, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID);
		}

		if (tr.startsolid)
		{
			G_Printf("FinishSpawningItem: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
			G_FreeEntity(ent);
			return;
		}

		// allow to ride movers
		ent->s.groundEntityNum = tr.entityNum;

		G_SetOrigin(ent, tr.endpos);
	}

	if (ent->spawnflags & 2)          // spin
	{
		ent->s.eFlags |= EF_SPINNING;
	}

	// team slaves and targeted items aren't present at start
	if ((ent->flags & FL_TEAMSLAVE) || ent->targetname)
	{
		ent->flags |= FL_NODRAW;
		//ent->s.eFlags |= EF_NODRAW;
		ent->r.contents = 0;
		return;
	}

	// health/ammo can potentially be multi-stage (multiple use)
	if (ent->item->giType == IT_HEALTH || ent->item->giType == IT_AMMO)
	{
		int i;

		// having alternate models defined in bg_misc.c for a health or ammo item specify it as "multi-stage"
		// - left-hand operand of comma expression has no effect
		// initial line: for(i=0;i<4,ent->item->world_model[i];i++) {}
		for (i = 0; i < 4 && ent->item->world_model[i] ; i++)
		{
		}

		ent->s.density = i - 1;   // store number of stages in 'density' for client (most will have '1')
	}

	trap_LinkEntity(ent);
}
Exemple #22
0
/*
 * @brief Parse misc_emits from the bsp after it has been loaded. This must
 * be called after Cm_LoadMap, once per pre-cache routine.
 */
void Cg_LoadEmits(void) {
	const char *ents;
	char class_name[MAX_QPATH];
	cg_emit_t *e;
	_Bool entity, emit;

	memset(&cg_emits, 0, sizeof(cg_emits));
	cg_num_emits = 0;

	ents = cgi.EntityString();

	memset(class_name, 0, sizeof(class_name));
	entity = emit = false;

	e = NULL;

	while (true) {

		const char *c = ParseToken(&ents);

		if (*c == '\0')
			break;

		if (*c == '{')
			entity = true;

		if (!entity) // skip any whitespace between ents
			continue;

		if (*c == '}') {
			entity = false;

			if (emit) {

				// resolve the leaf so that the entity may be added only when in PVS
				e->leaf = cgi.LeafForPoint(e->org, NULL);

				// add default sounds and models
				if (!e->sample) {

					if (e->flags & EMIT_SPARKS) {
						strcpy(e->sound, "world/sparks");
						e->sample = cgi.LoadSample(e->sound);
					}

					else if (e->flags & EMIT_STEAM) { // steam hissing
						strcpy(e->sound, "world/steam");
						e->sample = cgi.LoadSample(e->sound);
					}

					else if (e->flags & EMIT_FLAME) { // fire crackling
						strcpy(e->sound, "world/fire");
						e->sample = cgi.LoadSample(e->sound);
					}
				}

				// crutch up flags as a convenience
				if (e->sample)
					e->flags |= EMIT_SOUND;

				if (e->mod)
					e->flags |= EMIT_MODEL;

				if (VectorCompare(e->color, vec3_origin)) // default color
					VectorSet(e->color, 1.0, 1.0, 1.0);

				if (e->count <= 0) // default particle count
					e->count = 12;

				if (e->radius <= 0.0) { // default light and corona radius

					if (e->flags & EMIT_CORONA)
						e->radius = 12.0;
					else if (e->flags & EMIT_LIGHT)
						e->radius = 100.0;
					else
						e->radius = 1.0;
				}

				if (VectorCompare(e->vel, vec3_origin)) { // default velocity

					if (e->flags & EMIT_STEAM)
						VectorSet(e->vel, 0.0, 0.0, 40.0);
				}

				if (e->flags & EMIT_SPARKS) { // default directional scale
					VectorScale(e->dir, 40.0, e->dir);
				}

				if (e->scale <= 0.0) { // default mesh model scale
					e->scale = 1.0;
				}

				if (e->hz <= 0.0) { // default hz and drift

					if (e->flags & EMIT_LIGHT) {
						if (e->hz == 0.0) // -1.0 for constant light
							e->hz = 0.5;
					} else if (e->flags & EMIT_SPARKS)
						e->hz = 0.5;
					else if (e->flags & EMIT_STEAM)
						e->hz = 20.0;
					else if (e->flags & EMIT_FLAME)
						e->hz = 5.0;
					else if (e->flags & EMIT_SOUND)
						e->hz = 0.0; // ambient
					else
						e->hz = 1.0;
				}

				if (e->drift <= 0.0) {

					if (e->flags & (EMIT_LIGHT | EMIT_SPARKS))
						e->drift = 3.0;
					else
						e->drift = 0.01;
				}

				if (e->flags & EMIT_SOUND) { // resolve attenuation and looping

					if (e->atten == -1) // explicit -1 for global
						e->atten = ATTEN_NONE;
					else {
						if (e->atten == 0) { // default
							if (e->flags & EMIT_SPARKS) {
								e->atten = ATTEN_STATIC;
							} else {
								e->atten = ATTEN_DEFAULT;
							}
						}
					}

					// flame and steam sounds are always looped
					if (e->flags & (EMIT_FLAME | EMIT_STEAM))
						e->loop = true;
					else
						// the default is to honor the hz parameter
						e->loop = e->hz == 0.0;
				}

				if (e->flags & EMIT_SPARKS) // don't combine sparks and light
					e->flags &= ~EMIT_LIGHT;

				cgi.Debug("Added %d emit at %s\n", e->flags, vtos(e->org));

				cg_num_emits++;
			} else
				memset(&cg_emits[cg_num_emits], 0, sizeof(cg_emit_t));

			emit = false;
		}

		if (!g_strcmp0(c, "classname")) {

			c = ParseToken(&ents);
			g_strlcpy(class_name, c, sizeof(class_name));

			if (!g_strcmp0(c, "misc_emit") || !g_strcmp0(c, "misc_model"))
				emit = true;
		}

		e = &cg_emits[cg_num_emits];

		if (!g_strcmp0(c, "flags") || !g_strcmp0(c, "spawnflags")) {
			e->flags = atoi(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "origin")) {
			sscanf(ParseToken(&ents), "%f %f %f", &e->org[0], &e->org[1], &e->org[2]);
			continue;
		}

		if (!g_strcmp0(c, "angles")) { // resolve angles and directional vector
			sscanf(ParseToken(&ents), "%f %f %f", &e->angles[0], &e->angles[1], &e->angles[2]);
			AngleVectors(e->angles, e->dir, NULL, NULL);
			continue;
		}

		if (!g_strcmp0(c, "color")) { // resolve color as vector
			sscanf(ParseToken(&ents), "%f %f %f", &e->color[0], &e->color[1], &e->color[2]);
			continue;
		}

		if (!g_strcmp0(c, "hz")) {
			e->hz = atof(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "drift")) {
			e->drift = atof(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "radius")) {
			e->radius = atof(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "flicker")) {
			e->flicker = atof(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "scale")) {
			sscanf(ParseToken(&ents), "%f", &e->scale);
			continue;
		}

		if (!g_strcmp0(c, "count")) {
			e->count = atoi(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "sound")) {
			g_snprintf(e->sound, sizeof(e->sound), "%s", ParseToken(&ents));
			e->sample = cgi.LoadSample(e->sound);
			continue;
		}

		if (!g_strcmp0(c, "attenuation")) {
			e->atten = atoi(ParseToken(&ents));
			continue;
		}

		if (!g_strcmp0(c, "model")) {
			g_strlcpy(e->model, ParseToken(&ents), sizeof(e->model));
			e->mod = cgi.LoadModel(e->model);
			continue;
		}

		if (!g_strcmp0(c, "velocity")) {
			sscanf(ParseToken(&ents), "%f %f %f", &e->vel[0], &e->vel[1], &e->vel[2]);
			continue;
		}
	}
}
void SP_func_train_spline (edict_t *self)
{
	self->movetype = MOVETYPE_PUSH;

	VectorClear (self->s.angles);
	self->blocked = train_blocked;
	if (self->spawnflags & TRAIN_BLOCK_STOPS)
		self->dmg = 0;
	else
	{
		if (!self->dmg)
			self->dmg = 100;
	}
	self->solid = SOLID_BSP;
	gi.setmodel (self, self->model);

	if (st.noise)
		self->moveinfo.sound_middle = gi.soundindex  (st.noise);

#ifdef LOOP_SOUND_ATTENUATION
	if (self->attenuation <= 0)
		self->attenuation = ATTN_IDLE;
#endif

	if (!self->speed)
		self->speed = 100;

	// Lazarus: Do NOT set default values for rotational speeds - if they're 0, then they're 0.

	self->moveinfo.speed = self->speed;
	self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
	self->use = train_spline_use;

	// Lazarus: damageable
	if (self->health) {
		self->die = train_die;
		self->takedamage = DAMAGE_YES;
	} else {
		self->die = NULL;
		self->takedamage = DAMAGE_NO;
	}

	gi.linkentity (self);
	if (self->target)
	{
		// start trains on the second frame, to make sure their targets have had
		// a chance to spawn
		self->nextthink = level.time + FRAMETIME;
		self->think = func_train_spline_find;
	}
	else
	{
		gi.dprintf ("func_train_spline without a target at %s\n", vtos(self->absmin));
	}

	// Lazarus: TRAIN_SMOOTH forces trains to go directly to Move_Done from
	//       Move_Final rather than slowing down (if necessary) for one
	//       frame.
	if (self->spawnflags & TRAIN_SMOOTH)
		self->smooth_movement = true;
	else
		self->smooth_movement = false;

	// Lazarus: make noise field work w/o origin brush
	// ver. 1.3 change - do this for ALL trains
//	if(st.noise && !VectorLength(self->s.origin) )
	if(st.noise)
	{
		edict_t *speaker;

		self->noise_index    = self->moveinfo.sound_middle;
		self->moveinfo.sound_middle = 0;
		speaker = G_Spawn();
		speaker->classname   = "moving_speaker";
		speaker->s.sound     = 0;
		speaker->volume      = 1;
		speaker->attenuation = self->attenuation; // was 1
		speaker->owner       = self;
		speaker->think       = Moving_Speaker_Think;
		speaker->nextthink   = level.time + 2*FRAMETIME;
		speaker->spawnflags  = 7;       // owner must be moving to play
		self->speaker        = speaker;
		if(VectorLength(self->s.origin))
			VectorCopy(self->s.origin,speaker->s.origin);
		else {
			VectorAdd(self->absmin,self->absmax,speaker->s.origin);
			VectorScale(speaker->s.origin,0.5,speaker->s.origin);
		}
		VectorSubtract(speaker->s.origin,self->s.origin,speaker->offset);
	}

}
Exemple #24
0
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 );
}
Exemple #25
0
BOOL CPreStylePag::CreateTextStyle(
                       CString strTSName,
                       CString strShxFile,
                       CString strBigFile,
                       double  dHeight,
                       double  dWidthFactor,
                       double  dAngleByDegree,
                       short   iGenerationFlag)
{
    //局部变量定义和初始化
    CMObject obj, newobj, tsobj;
    long      i, nCount;
    CString  tmpTSName, strtmp;

    strTSName.TrimLeft();
    strTSName.TrimRight();
    if(strTSName.GetLength() <= 0) return FALSE;

    strShxFile.TrimLeft();
    strShxFile.TrimRight();
    if(strShxFile.GetLength() <= 0) return FALSE;

    strBigFile.TrimLeft();
    strBigFile.TrimRight();
    if(strBigFile.GetLength() <= 0) return FALSE;
    if(strBigFile == "不使用大字体") strBigFile = " ";

    if(dHeight < 0.0) dHeight = 0.0;
    if(dWidthFactor < 0.0) dWidthFactor = 1.0;
    if(dAngleByDegree > 85.0 || dAngleByDegree < -85.0) dAngleByDegree = 0.0;
    iGenerationFlag &= 0x06;
    tmpTSName = strTSName;
    tmpTSName.MakeUpper();

    try
    {
        if(FindAcad() == FALSE)
        {
            return FALSE;
        }
        
        //SETUP-1: 获取ACAD文本样式列表
        obj = EDIBAcad::objAcadDoc.GetPropertyByName(
                                      _T("TextStyles")).pdispVal;
        
        //SETUP-2: 如果指定样式对象已经存在,则返回

		nCount = (long)obj.GetPropertyByName(_T("Count"));
		for( i = 0; i < nCount; i++)
		{
			tsobj = obj.Invoke(_T("Item"), 1, &_variant_t(i)).pdispVal;
			strtmp = vtos(tsobj.GetPropertyByName(_T("Name")));
			strtmp.TrimLeft();
            strtmp.TrimRight();
            strtmp.MakeUpper();
			if(strtmp == tmpTSName)
			{
                //目标样式已存在
                return FALSE;
			}
		}

        //SETUP-3: 添加新的文本样式
        obj.Invoke(_T("Add"),
                   1,
                   &_variant_t(strTSName));
        
        //SETUP-4: 获取新样式对象
        newobj = obj.Invoke(_T("Item"),
                            1,
                            &_variant_t(strTSName)).pdispVal;
        
        //SETUP-5: 设定新样式的属性值
        if(newobj.p)//成功获取新对象
        {
            newobj.PutPropertyByName(_T("FontFile"),           //设定字体文件名
                   &_variant_t(strShxFile));

            newobj.PutPropertyByName(_T("BigFontFile"),        //设定大字体文件名
                   &_variant_t(strBigFile));

            newobj.PutPropertyByName(_T("Height"),             //设定字体高度
                   &_variant_t(dHeight));
            newobj.PutPropertyByName(_T("Width"),              //设定宽度比例因子***
                   &_variant_t(dWidthFactor));
            newobj.PutPropertyByName(_T("ObliqueAngle"),       //设定字体倾斜角度
                   &_variant_t(dAngleByDegree));
            newobj.PutPropertyByName(_T("TextGenerationFlag"), //设定字体生成字段
                   &_variant_t(iGenerationFlag));
            
            return TRUE;
        }
    }
	catch (_com_error &e)
	{
		CString strMsg;
		strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
		AfxMessageBox(strMsg);
	}
    catch(...)
    {
    }
    return FALSE;
}
Exemple #26
0
int width(string conds){
	vector<string> tokens = tokenize(conds, ",");
	set<string> tokens_set = vtos(tokens);

	return setintersection( tokens_set,heuristics).size();
}
Exemple #27
0
BOOL CPreStylePag::GetTextStyleProperty(
                       CString  strTSName,
                       CString &strShxFile,
                       CString &strBigFile,
                       double  &dHeight,
                       double  &dWidthFactor,
                       double  &dAngleByDegree,
                       short   &iGenerationFlag)
{
    CMObject obj, tsobj;
    long     i, nCount;
    CString  strtmp;

    //进行参数检查和初始化
    strTSName.TrimLeft();
    strTSName.TrimRight();
    strTSName.MakeUpper();
    if(strTSName.GetLength() <= 0) return FALSE;

    try
    {
        if(FindAcad() == FALSE)
        {
            return FALSE;
        }
        
        //SETUP-1: 获取ACAD文本样式列表
        obj = EDIBAcad::objAcadDoc.GetPropertyByName(
                                      _T("TextStyles"));
        
        //SETUP-2: 获取样式对象

		nCount = (long)obj.GetPropertyByName(_T("Count"));
		for( i = 0; i < nCount; i++)
		{
			tsobj = obj.Invoke(_T("Item"), 1, &_variant_t(i));
			strtmp = vtos(tsobj.GetPropertyByName(_T("Name")));
			strtmp.TrimLeft();
            strtmp.TrimRight();
			strtmp.MakeUpper();
			if(strtmp == strTSName)
			{
                //获得目标样式的属性值
                strShxFile      = vtos(tsobj.GetPropertyByName(
                                 _T("FontFile")));   //获得字体文件名
                strBigFile      = vtos(tsobj.GetPropertyByName(
                                 _T("BigFontFile")));//获得大字体文件名
                
                dHeight         = vtod(tsobj.GetPropertyByName(
                                 _T("Height")));     //获得字体高度

                dWidthFactor    = vtod(tsobj.GetPropertyByName(
                                 _T("Width")));      //获得宽度比例因子***

                dAngleByDegree  = vtod(tsobj.GetPropertyByName(
                                 _T("ObliqueAngle")));        //获得字体倾斜角度
                dAngleByDegree  *= 180.0;
                dAngleByDegree  /= 3.14159265359;
                if(dAngleByDegree > 270.0) dAngleByDegree -= 360;
                
                iGenerationFlag = vtoi(tsobj.GetPropertyByName(
                                 _T("TextGenerationFlag")));  //获得字体生成字段
                iGenerationFlag &= 0x06;

                return TRUE;
			}
		}
    }
	catch (_com_error &e)
	{
		CString strMsg;
		strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
		AfxMessageBox(strMsg);
    }
    return FALSE;
}
Exemple #28
0
/*QUAK-ED target_teleporter (1 0 0) (-8 -8 -8) (8 8 8)
The activator will be teleported away.
*/
void SP_target_teleporter( gentity_t *self ) {
	if (!self->targetname)
		gi.Printf("untargeted %s at %s\n", self->classname, vtos(self->s.origin));

	self->e_UseFunc = useF_target_teleporter_use;
}
Exemple #29
0
/*
 * @brief Main entry point for drawing the scene (world and entities).
 */
void R_DrawView(void) {

	R_UpdateFrustum();

	R_UpdateVis();

	R_MarkBspSurfaces();

	R_EnableFog(true);

	R_DrawSkyBox();

	// wait for the client to fully populate the scene
	Thread_Wait(r_view.thread);

	// dispatch threads to cull entities and sort elements while we draw the world
	thread_t *cull_entities = Thread_Create(R_CullEntities, NULL);
	thread_t *sort_elements = Thread_Create(R_SortElements, NULL);

	R_MarkLights();

	const r_sorted_bsp_surfaces_t *surfs = r_model_state.world->bsp->sorted_surfaces;

	R_DrawOpaqueBspSurfaces(&surfs->opaque);

	R_DrawOpaqueWarpBspSurfaces(&surfs->opaque_warp);

	R_DrawAlphaTestBspSurfaces(&surfs->alpha_test);

	R_EnableBlend(true);

	R_DrawBackBspSurfaces(&surfs->back);

	R_DrawMaterialBspSurfaces(&surfs->material);

	R_DrawFlareBspSurfaces(&surfs->flare);

	R_EnableBlend(false);

	// wait for entity culling to complete
	Thread_Wait(cull_entities);

	R_DrawEntities();

	R_EnableBlend(true);

	// wait for element sorting to complete
	Thread_Wait(sort_elements);

	R_DrawElements();

	R_EnableFog(false);

	R_DrawDeveloperTools();

	R_DrawCoronas();

	R_EnableBlend(false);

	R_ResetArrayState();

#if 0
	vec3_t tmp;
	VectorMA(r_view.origin, MAX_WORLD_DIST, r_view.forward, tmp);

	cm_trace_t tr = Cl_Trace(r_view.origin, tmp, NULL, NULL, cl.client_num + 1, MASK_SOLID);
	if (tr.fraction > 0.0 && tr.fraction < 1.0) {
		Com_Print("%s: %d: %s\n", tr.surface->name, tr.plane.num, vtos(tr.plane.normal));
	}

#endif
}
Exemple #30
0
void SP_misc_holocron(gentity_t *ent)
{
	vec3_t dest;
	trace_t tr;

	if (g_gametype.integer != GT_HOLOCRON)
	{
		G_FreeEntity(ent);
		return;
	}

	if (HasSetSaberOnly())
	{
		if (ent->count == FP_SABERATTACK ||
			ent->count == FP_SABERDEFEND ||
			ent->count == FP_SABERTHROW)
		{ //having saber holocrons in saber only mode is pointless
			G_FreeEntity(ent);
			return;
		}
	}

	ent->s.isJediMaster = qtrue;

	VectorSet( ent->r.maxs, 8, 8, 8 );
	VectorSet( ent->r.mins, -8, -8, -8 );

	ent->s.origin[2] += 0.1;
	ent->r.maxs[2] -= 0.1;

	VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );
	trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );
	if ( tr.startsolid )
	{
		G_Printf ("SP_misc_holocron: misc_holocron startsolid at %s\n", vtos(ent->s.origin));
		G_FreeEntity( ent );
		return;
	}

	//add the 0.1 back after the trace
	ent->r.maxs[2] += 0.1;

	// allow to ride movers
//	ent->s.groundEntityNum = tr.entityNum;

	G_SetOrigin( ent, tr.endpos );

	if (ent->count < 0)
	{
		ent->count = 0;
	}

	if (ent->count >= NUM_FORCE_POWERS)
	{
		ent->count = NUM_FORCE_POWERS-1;
	}
/*
	if (g_forcePowerDisable.integer &&
		(g_forcePowerDisable.integer & (1 << ent->count)))
	{
		G_FreeEntity(ent);
		return;
	}
*/
	//No longer doing this, causing too many complaints about accidentally setting no force powers at all
	//and starting a holocron game (making it basically just FFA)

	ent->enemy = NULL;

	ent->s.eFlags = EF_BOUNCE_HALF;

	ent->s.modelindex = (ent->count - 128);//G_ModelIndex(holocronTypeModels[ent->count]);
	ent->s.eType = ET_HOLOCRON;
	ent->s.pos.trType = TR_GRAVITY;
	ent->s.pos.trTime = level.time;

	ent->r.contents = CONTENTS_TRIGGER;
	ent->clipmask = MASK_SOLID;

	ent->s.trickedentindex4 = ent->count;

	if (forcePowerDarkLight[ent->count] == FORCE_DARKSIDE)
	{
		ent->s.trickedentindex3 = 1;
	}
	else if (forcePowerDarkLight[ent->count] == FORCE_LIGHTSIDE)
	{
		ent->s.trickedentindex3 = 2;
	}
	else
	{
		ent->s.trickedentindex3 = 3;
	}

	ent->physicsObject = qtrue;

	VectorCopy(ent->s.pos.trBase, ent->s.origin2); //remember the spawn spot

	ent->touch = HolocronTouch;

	trap_LinkEntity(ent);

	ent->think = HolocronThink;
	ent->nextthink = level.time + 50;
}