Пример #1
0
// Position buffer for output at a specified location and size.
//      If data will extend buffer size, reserve space
//      If data will rewrite existing data
//              position for write and return previous buffer size
//
//      If data will append to buffer
//              position for write and return new size
size_t Outbuffer::position(size_t pos, size_t nbytes)
{
    size_t current_sz = size();
    unsigned char *fend = buf+pos+nbytes;       // future end of buffer
    if (fend >= pend)
    {
        reserve (fend - pend);
    }
    setsize(pos);
    return pos+nbytes > current_sz ? pos+nbytes : current_sz;
}
Пример #2
0
static void fb_spawn_spawnpoint(gedict_t* ent) {
	AddToQue(ent);
	ent->s.v.solid = SOLID_TRIGGER;
	ent->touch = (func_t) marker_touch;
	ent->s.v.flags = FL_ITEM;
	BecomeMarker(ent);
	setsize(ent, -65, -65, -24, 65, 65, 32);
	SetVector (ent->s.v.view_ofs, 80, 80, 24);
	ent->fb.pickup = pickup_true;
	adjust_view_ofs_z(ent);
}
Пример #3
0
void redo(XEvent * event,void *xw){
	switch (event->type)
		{
		case Expose:
		 if (event->xexpose.count!=0) break;
		 redraw(event,&event->xexpose.window);
		 break;
		case ConfigureNotify: setsize(event->xconfigure.width, event->xconfigure.height); // assuming there will be an expose afterwards
		  break;	
		}
}
Пример #4
0
	int add(const T& elem, int index)
	{
		setsize(len()+1);
		
		for(int i = num_elements-1; i > index; i--)
			list[i] = list[i-1];

		list[index] = elem;
		
		//num_elements++;
		return num_elements-1;
	}
Пример #5
0
// assign one vector to another
const Vector& Vector::operator=(const Vector& v2){
  int i;

  if(N != v2.N){
    delete []v;
    setsize(v2.N);
  }
  for(i = 0; i < N; i++)
    v[i] = v2.v[i];

  return *this;
}
Пример #6
0
static void fb_spawn_trigger_teleport (gedict_t* ent)
{
	AddToQue (ent);

	//Com_Printf ("fb_trigger_tele([%f %f %f] > [%f %f %f])\n", PASSVEC3 (ent->s.v.mins), PASSVEC3 (ent->s.v.maxs));
	VectorSet (ent->fb.virtual_mins, ent->s.v.mins[0] - 18, ent->s.v.mins[1] - 18, ent->s.v.mins[2] - 34);
	VectorSet (ent->fb.virtual_maxs, ent->s.v.maxs[0] + 18, ent->s.v.maxs[1] + 18, ent->s.v.maxs[2] + 26);
	setsize(ent, ent->s.v.mins[0] - 32, ent->s.v.mins[1] - 32, ent->s.v.mins[2], ent->s.v.maxs[0] + 32, ent->s.v.maxs[1] + 32, ent->s.v.maxs[2]);
	VectorSet (ent->s.v.view_ofs, 0.5 * (ent->s.v.absmax[0] - ent->s.v.absmin[0]), 0.5 * (ent->s.v.absmax[1] - ent->s.v.absmin[1]), 0.5 * (ent->s.v.absmax[2] - ent->s.v.absmin[2]));
	adjust_view_ofs_z(ent);
	BecomeMarker(ent);
}
Пример #7
0
// Throw Toaster
void Toaster ( )
{
	gedict_t *missile;
	if ( self->no_grenades_2 < 2 ) {
		G_sprint( self, 1, "Not enough type 2 grenades... get more\n" );
		return;
	}
	if (!tf_data.drop2)
	{
		G_sprint (self, 2, "Toasters have been disabled by the admin!\n");
		return;
	}
	self->no_grenades_2 = self->no_grenades_2 - 2;
	sound( self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM );
	missile = spawn(  );
	missile->s.v.owner = EDICT_TO_PROG( self );
	missile->s.v.movetype = 10;
	missile->s.v.solid = 2;
	missile->s.v.classname = "grenade";
	missile->s.v.effects = 8;

	// throw that toaster!
	makevectors( self->s.v.v_angle );
	if (self->s.v.v_angle[0]) {
		missile->s.v.velocity[0] =
		    g_globalvars.v_forward[0] * 600 + g_globalvars.v_up[0] * 200 +
		    crandom(  ) * g_globalvars.v_right[0] * 10 + crandom(  ) * g_globalvars.v_up[0] * 10;
		missile->s.v.velocity[1] =
		    g_globalvars.v_forward[1] * 600 + g_globalvars.v_up[1] * 200 +
		    crandom(  ) * g_globalvars.v_right[1] * 10 + crandom(  ) * g_globalvars.v_up[1] * 10;
		missile->s.v.velocity[2] =
		    g_globalvars.v_forward[2] * 600 + g_globalvars.v_up[2] * 200 +
		    crandom(  ) * g_globalvars.v_right[2] * 10 + crandom(  ) * g_globalvars.v_up[0] * 10;
	}
	else {
		//missile->s.v.velocity = aim(self, 10000);
		aim( self->s.v.velocity );	// = aim(self, 10000);
		missile->s.v.velocity[0] = missile->s.v.velocity[0] * 600;
		missile->s.v.velocity[1] = missile->s.v.velocity[1] * 600;
//		missile->s.v.velocity[2] = missile->s.v.velocity[2] * 600;
		missile->s.v.velocity[2] = 200;
	}
	SetVector( missile->s.v.avelocity, 300, 300, 300 );
	//missile.angles = vectoangles(missile.velocity);
	vectoangles( missile->s.v.velocity, missile->s.v.angles );
	missile->s.v.touch = ( func_t ) ToasterTouch;
	missile->s.v.nextthink = g_globalvars.time + 3;
	missile->s.v.think = ( func_t ) ToasterElec;
	setmodel( missile, "progs/v_spike.mdl" );
	setsize( missile, 0, 0, 0, 0, 0, 0 );
	setorigin( missile, self->s.v.origin[0], self->s.v.origin[1], self->s.v.origin[2]);
}
Пример #8
0
lowerMatrix<T>::lowerMatrix (const lowerMatrix<T>& cpy)
{
  m_dimentions = cpy.getdimentions();
  setsize(m_dimentions);

  for (int i=0; i < m_dimentions; i++)
  {
    for (int j=0; j < i+1; j++)
    {
      m_data[i][j] = cpy.m_data[i][j];
    }
  }
}
Пример #9
0
static void fb_spawn_teleport_destination (gedict_t* ent)
{
	AddToQue (ent);

	ent->s.v.solid = SOLID_TRIGGER;
	ent->touch = (func_t) fb_spawn_teleport_destination_touch;
	ent->s.v.flags = FL_ITEM;
	BecomeMarker (ent);
	setsize (ent, -65, -65, -24 - 27, 65, 65, 32);  // -27 extra to get back to floor
	VectorSet(ent->s.v.view_ofs, 80, 80, 24);
	ent->fb.pickup = pickup_true;
	adjust_view_ofs_z (ent);
}
Пример #10
0
lowerMatrix<T>& lowerMatrix<T>::operator=(const lowerMatrix<T>& source)
{
  m_dimentions = source.getdimentions();
  setsize(m_dimentions);

  for (int i=0; i < m_dimentions; i++)
  {
    for (int j=0; j < i+1; j++)
    {
      m_data[i][j] = source.m_data[i][j];
    }
  }
  return *this;
}
Пример #11
0
gedict_t       *spawn_field( vec3_t fmins, vec3_t fmaxs )
{
	gedict_t       *trigger;

	trigger = spawn();
	trigger->s.v.movetype = MOVETYPE_NONE;
	trigger->s.v.solid = SOLID_TRIGGER;
	trigger->s.v.owner = EDICT_TO_PROG( self );
	trigger->s.v.touch = ( func_t ) door_trigger_touch;

	setsize( trigger, fmins[0] - 60, fmins[1] - 60, fmins[2] - 8, fmaxs[0] + 60,
		      fmaxs[1] + 60, fmaxs[2] + 8 );
	return ( trigger );
}
Пример #12
0
/* reinitialize window size after SIGWINCH */
void windowinit()
{
	windowchg = 0;
	setsize();
	if(value(vi_WINDOW) >= lines || options[vi_WINDOW].odefault == value(vi_WINDOW))
		value(vi_WINDOW) = lines -1;
	options[vi_WINDOW].odefault = lines - 1;
	if(options[vi_SCROLL].odefault == value(vi_SCROLL))
		value(vi_SCROLL) = value(vi_WINDOW)/2;
	options[vi_SCROLL].odefault = (lines - 1)/2;
	vsetsiz(value(vi_WINDOW));
	setwind();
	vok(atube, 1);
}
Пример #13
0
bool fimg::load(wchar_t *name)
{
	lpt = gettex(name);

	if(lpt)
	{
		D3DXMatrixIdentity(&scale);
		D3DXMatrixIdentity(&trans);
		D3DXMatrixIdentity(&rot);

		setsize(lpt->width,lpt->height);
	}

	return bool(lpt);
}
Пример #14
0
void imgbase::rtt_draw_func()
{
	if(lpt)
	{
		setpos(*nowx, *nowy);
		setsize(*width, *height);
		setrota(*rota, *rota_x, *rota_y);
		g_pd3dD->SetTransform(D3DTS_WORLD,&(scale*rot*trans));
		g_pd3dD->SetTexture( 0, lpt->tex );
		g_pd3dD->SetTextureStageState(0, D3DTSS_ALPHAOP , D3DTOP_SELECTARG1);
		g_pd3dD->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
		g_pd3dD->SetStreamSource( 0, lpVB, 0, sizeof( Vertex ) );
		g_pd3dD->SetFVF( VertexFVF );
		g_pd3dD->DrawPrimitive( D3DPT_TRIANGLESTRIP ,0, 2 );
	}
}
Пример #15
0
//=========================================================================
// Fire a laserbolt		 -- mtf style
void W_FireLaser(  )
{
    vec3_t vec;
    vec3_t org;

    self->s.v.currentammo = --( self->s.v.ammo_nails );

    makevectors( self->s.v.v_angle );
    VectorScale( g_globalvars.v_forward, 8, org );
    VectorAdd( self->s.v.origin, org, org );
    aim( vec );
    VectorNormalize( vec );

    newmis = spawn(  );
    newmis->s.v.owner = EDICT_TO_PROG( self );
    newmis->s.v.enemy = EDICT_TO_PROG( self ); // The real owner
    newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid = SOLID_TRIGGER;

	// set model, skin, and effects
    setmodel( newmis, "progs/beam.mdl" );
	if ( tf_data.coloredlights == TRUE ) {
		if ( self->team_no == 1 )
			newmis->s.v.effects = 64;
		else {
			if ( self->team_no == 2 )
				newmis->s.v.effects = 128;
			else
				newmis->s.v.effects = 2;
		}
	}
	else
		newmis->s.v.effects = 2;
	newmis->s.v.skin = self->team_no - 1;

	SetVector( newmis->s.v.avelocity, 0, 0, 500 );
    setsize( newmis, 0, 0, 0, 0, 0, 0 );
    setorigin( newmis, org[0], org[1], org[2] + 16 );
    VectorScale( vec, 1500, newmis->s.v.velocity );
    vectoangles( newmis->s.v.velocity, newmis->s.v.angles );
	newmis->s.v.angles[1] += 0.1;
    VectorCopy( newmis->s.v.velocity, newmis->s.v.oldorigin );
    newmis->s.v.nextthink = g_globalvars.time + 5;
    newmis->s.v.think = ( func_t ) SUB_Remove;
    newmis->s.v.touch = ( func_t ) LaserBolt_Touch;
}
Пример #16
0
// Item creation functions 
static void PlaceItemFB (gedict_t* ent)
{
	vec3_t new_size = { 49, 49, 0 };

	if (ent->fb.fixed_size[0])
		new_size[0] = ent->fb.fixed_size[0] / 2 - 15;
	if (ent->fb.fixed_size[1])
		new_size[1] = ent->fb.fixed_size[1] / 2 - 15;
	if (ent->fb.fixed_size[2])
		new_size[2] = ent->fb.fixed_size[2] / 2 - 0;

	ent->s.v.movetype = MOVETYPE_NONE;
	setsize(ent, ent->s.v.mins[0] - new_size[0], ent->s.v.mins[1] - new_size[1], ent->s.v.mins[2], ent->s.v.maxs[0] + new_size[0], ent->s.v.maxs[1] + new_size[1], ent->s.v.maxs[2]);
	adjust_view_ofs_z(ent);
	VectorSet (ent->fb.virtual_mins, ent->s.v.absmin[0] + (new_size[0] - 49 + 32), ent->s.v.absmin[1] + (new_size[1] - 49 + 32), ent->s.v.absmin[2] - (new_size[2] - 0 + 33));
	VectorSet (ent->fb.virtual_maxs, ent->fb.virtual_mins[0] + 96, ent->fb.virtual_mins[1] + 96, ent->fb.virtual_mins[2] + 114);
}
Пример #17
0
Файл: player.c Проект: deurk/ktx
void ThrowHead( char *gibname, float dm )
{
	setmodel( self, gibname );
	self->s.v.frame = 0;
	self->s.v.movetype = MOVETYPE_BOUNCE;
// qqshka: NO, you can't do that, that NOT projectile, its player entity!
//	self->isMissile = true;
	self->s.v.takedamage = DAMAGE_NO;
	self->s.v.solid = SOLID_NOT;
	SetVector( self->s.v.view_ofs, 0, 0, 8 );
	setsize( self, -16, -16, 0, 16, 16, 56 );
	VelocityForDamage( dm, self->s.v.velocity );
	self->s.v.origin[2] = self->s.v.origin[2] - 24;
	self->s.v.flags -= ( ( int ) ( self->s.v.flags ) ) & FL_ONGROUND;

	SetVector( self->s.v.avelocity, 0, crandom() * 600, 0 );
}
Пример #18
0
// Called from weapons.c
void GrappleThrow()
{
    if ( self->hook_out ) // only throw once
        return;

    g_globalvars.msg_entity = EDICT_TO_PROG( self );
    WriteByte( MSG_ONE, SVC_SMALLKICK );

    // chain out sound (loops)
    sound ( self, CHAN_WEAPON, "weapons/chain1.wav", 1, ATTN_NORM );

    newmis                = spawn();
    g_globalvars.newmis   = EDICT_TO_PROG( newmis );
    newmis->s.v.movetype  = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid     = SOLID_BBOX;
    newmis->s.v.owner     = EDICT_TO_PROG( self );
    self->hook            = newmis;
    newmis->s.v.classname = "hook";

    trap_makevectors ( self->s.v.v_angle );

    // Weapon velocitys should not be based on server maxspeed imo
    // Removing purectf velocity changes ( 2.5 * self->maxspeed )

    if ( self->ctf_flag & CTF_RUNE_HST )
        VectorScale( g_globalvars.v_forward, 1000, newmis->s.v.velocity );
    else
        VectorScale( g_globalvars.v_forward, 800, newmis->s.v.velocity );
    SetVector( newmis->s.v.avelocity, 0, 0, -500 );

    newmis->s.v.touch     = (func_t) GrappleAnchor;
    newmis->s.v.think     = (func_t) BuildChain;
    newmis->s.v.nextthink = g_globalvars.time + 0.1;

    if ( k_ctf_custom_models )
        setmodel ( newmis, "progs/star.mdl" );
    else
        setmodel ( newmis, "progs/v_spike.mdl" );

    setorigin(newmis, self->s.v.origin[0] + g_globalvars.v_forward[0] * 16,
              self->s.v.origin[1] + g_globalvars.v_forward[1] * 16,
              self->s.v.origin[2] + g_globalvars.v_forward[2] * 16 + 16);
    setsize( newmis, 0, 0, 0, 0, 0, 0 );
    self->hook_out = true;
}
Пример #19
0
int XvGrabber::command(int argc, const char*const* argv)
{
	Tcl& tcl = Tcl::instance();
	if (argc == 3) {
		if (strcmp(argv[1], "decimate") == 0) {
			int dec = atoi(argv[2]);
			Tcl& tcl = Tcl::instance();
			if (dec <= 0) {
				tcl.resultf("%s: divide by zero", argv[0]);
				return (TCL_ERROR);
			}
			if (dec != decimate_) {
				decimate_ = dec;
				setsize();
			}
			return (TCL_OK);
		} else if (strcmp(argv[1], "port") == 0) {
			setport(argv[2]);
			return (TCL_OK);
		} else if (strcmp(argv[1], "contrast") == 0) {
			setattr(XAcontrast, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "brightness") == 0) {
			setattr(XAbrightness, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "hue") == 0) {
			setattr(XAhue, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "saturation") == 0) {
			setattr(XAsaturation, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "create-capwin") == 0) {
			capwin_ = new XvWindow(argv[2], &vinfo_, grabID_);
			tcl.result(capwin_->name());
			return (TCL_OK);
		}
	} else if (argc == 2) {
		if (strcmp(argv[1], "need-capwin") == 0) {
			tcl.result("1");
			return (TCL_OK);
		}
	}
	return (Grabber::command(argc, argv));
}
Пример #20
0
CWinSelect1Icon::CWinSelect1Icon()
{
	// 以下はデフォルト値です。
	// オブジェクト作成後に調整してください。
	m_maxwidth = 0;
	m_dpos.x = 0;
	m_dpos.y = 0;
	m_cur.x  = 0;
	m_cur.y  = 0;
	m_wpos.x = 1;
	m_wpos.y = 1;
	m_winx   = 0;
	m_winy   = 0;
	m_winw   = 5;
	m_winh   = 10;
	m_disable_cansel = false;
	m_cols   = 10;
	setsize(0, 0);		// Windowサイズ(デフォルト)
	movewin(5, 0);		// Window位置(デフォルト)(中央、マージンなし)
}
Пример #21
0
//
// MakeLink - spawns the chain link entities
//
gedict_t* MakeLink()
{
    newmis = spawn ();
    g_globalvars.newmis = EDICT_TO_PROG( newmis );

    newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid = SOLID_NOT;
    newmis->s.v.owner = EDICT_TO_PROG( self );
    SetVector ( newmis->s.v.avelocity, 200, 200, 200 );

    if ( k_ctf_custom_models )
        setmodel  ( newmis, "progs/bit.mdl" );
    else
        setmodel  ( newmis, "progs/spike.mdl" );

    setorigin ( newmis, PASSVEC3(self->s.v.origin) );
    setsize   ( newmis, 0, 0, 0, 0, 0, 0 );

    return newmis;
}
Пример #22
0
void W_FireRocket()
{
	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_rockets =
		    self->s.v.ammo_rockets - 1;

	sound( self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM );

	g_globalvars.msg_entity = EDICT_TO_PROG( self );
	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );

	newmis = spawn();
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	newmis->s.v.owner = EDICT_TO_PROG( self );
	newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
	newmis->s.v.solid = SOLID_BBOX;

// set newmis speed     
	makevectors( self->s.v.v_angle );
	aim( newmis->s.v.velocity );	// = aim(self, 1000);
	VectorScale( newmis->s.v.velocity, 1000, newmis->s.v.velocity );
// newmis->s.v.velocity = newmis->s.v.velocity * 1000;

	vectoangles( newmis->s.v.velocity, newmis->s.v.angles );
	
	newmis->s.v.touch = ( func_t ) T_MissileTouch;
	newmis->voided = 0;

// set newmis duration
	newmis->s.v.nextthink = g_globalvars.time + 5;
	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.classname = "rocket";

	setmodel( newmis, "progs/missile.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );

// setorigin (newmis, self->s.v.origin + v_forward*8 + '0 0 16');
	setorigin( newmis, self->s.v.origin[0] + g_globalvars.v_forward[0] * 8,
			self->s.v.origin[1] + g_globalvars.v_forward[1] * 8,
			self->s.v.origin[2] + g_globalvars.v_forward[2] * 8 + 16 );
}
Пример #23
0
void W_FireSuperSpikes()
{
	vec3_t          dir, tmp;

// gedict_t*    old;

	sound( self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM );
	self->attack_finished = g_globalvars.time + 0.2;
	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_nails = self->s.v.ammo_nails - 2;
	aim( dir );		//dir = aim (self, 1000);

	VectorCopy( self->s.v.origin, tmp );
	tmp[2] += 16;
	launch_spike( tmp, dir );
	newmis->s.v.touch = ( func_t ) superspike_touch;
	setmodel( newmis, "progs/s_spike.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );
	g_globalvars.msg_entity = EDICT_TO_PROG( self );
	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );
}
Пример #24
0
gedict_t* spawn_buble( gedict_t* self )
{
	gedict_t *bubble;

	bubble = spawn(  );
	setmodel( bubble, "progs/s_bubble.spr" );
	setorigin( bubble, PASSVEC3( self->s.v.origin ) );
	bubble->s.v.movetype = MOVETYPE_NOCLIP;
	bubble->s.v.solid = SOLID_NOT;

	SetVector( bubble->s.v.velocity, 0, 0, 15 );
	bubble->s.v.nextthink = g_globalvars.time + 0.5;
	bubble->s.v.think = ( func_t ) bubble_bob;
	bubble->s.v.touch = ( func_t ) bubble_remove;
	bubble->s.v.classname = "bubble";
	bubble->s.v.frame = 0;
	bubble->cnt = 0;

	setsize( bubble, -8, -8, -8, 8, 8, 8 );
    return bubble;
}
Пример #25
0
int scsicam_bios_param (Disk *disk, /* SCSI disk */
	kdev_t dev,		/* Device major, minor */
    	int *ip			/* Heads, sectors, cylinders in that order */) {

    struct buffer_head *bh;
    int ret_code;
    int size = disk->capacity;
    unsigned long temp_cyl;

    if (!(bh = bread(MKDEV(MAJOR(dev), MINOR(dev)&~0xf), 0, 1024)))
	return -1;

    /* try to infer mapping from partition table */
    ret_code = scsi_partsize (bh, (unsigned long) size, (unsigned int *) ip + 2, 
	(unsigned int *) ip + 0, (unsigned int *) ip + 1);
    brelse (bh);

    if (ret_code == -1) {
	/* pick some standard mapping with at most 1024 cylinders,
	   and at most 62 sectors per track - this works up to
	   7905 MB */
	ret_code = setsize ((unsigned long) size, (unsigned int *) ip + 2, 
    	    (unsigned int *) ip + 0, (unsigned int *) ip + 1);
    }

    /* if something went wrong, then apparently we have to return
       a geometry with more than 1024 cylinders */
    if (ret_code || ip[0] > 255 || ip[1] > 63) {
	 ip[0] = 64;
	 ip[1] = 32;
	 temp_cyl = size / (ip[0] * ip[1]);
	 if (temp_cyl > 65534) {
	      ip[0] = 255;
	      ip[1] = 63;
	 }
	 ip[2] = size / (ip[0] * ip[1]);
    }

    return 0;
}
Пример #26
0
void launch_spike( vec3_t org, vec3_t dir )
{

	newmis = spawn();
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	newmis->voided = 0;
	newmis->s.v.owner = EDICT_TO_PROG( self );
	newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
	newmis->s.v.solid = SOLID_BBOX;

	vectoangles( dir, newmis->s.v.angles );

	newmis->s.v.touch = ( func_t ) spike_touch;
	newmis->s.v.classname = "spike";
	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.nextthink = g_globalvars.time + 6;
	setmodel( newmis, "progs/spike.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );
	setorigin( newmis, PASSVEC3( org ) );
	VectorScale( dir, 1000, newmis->s.v.velocity );
	//newmis->s.v.velocity = dir * 1000;
}
Пример #27
0
void spawn_tdeath( vec3_t org, gedict_t * death_owner )
{
	gedict_t *death;

	death = spawn(  );
	death->s.v.classname = "teledeath";
	death->s.v.movetype = MOVETYPE_NONE;
	death->s.v.solid = SOLID_TRIGGER;
	SetVector( death->s.v.angles, 0, 0, 0 );
	setsize( death, death_owner->s.v.mins[0] - 4, death_owner->s.v.mins[1] - 4,
		 death_owner->s.v.mins[2] - 4, death_owner->s.v.maxs[0] + 4,
		 death_owner->s.v.maxs[1] + 4, death_owner->s.v.maxs[2] + 4 );

	setorigin( death, PASSVEC3( org ) );

	death->s.v.touch = ( func_t ) tdeath_touch;
	death->s.v.nextthink = g_globalvars.time + 0.2;
	death->s.v.think = ( func_t ) SUB_Remove;
	death->s.v.owner = EDICT_TO_PROG( death_owner );

	g_globalvars.force_retouch = 2;	// make sure even still objects get hit
}
Пример #28
0
void PutClientInServer()
{
	local				entity	playerspwn;
	
	playerspwn = 		Player_FindStartPoint();
	player = self;		//now use player as global player entity
	player.classname = "player";
	player.health = 100;
	player.takedamage = DAMAGE_AIM;
	player.solid = SOLID_SLIDEBOX;
	player.movetype = MOVETYPE_WALK;
	player.origin = playerspwn.origin;
	player.angles = playerspwn.angles;
	player.fixangle = TRUE;		// turn this way immediately
	precache_model(MODEL_PLAYER);
	setmodel (player, MODEL_PLAYER); 
	setsize (player, VEC_HULL_MIN, VEC_HULL_MAX);
	player.flags = FL_CLIENT;
	player.touch = Player_TouchEnemy;
	player.SendEntity = Player_SendEntityToCSQC;//VITAL!
	self.Version = self.Version + 1;//Is this needed?
}
Пример #29
0
void MmeYuvGrabber::SetComp()
{
    /* fprintf(stderr,"vic: Called MmeYUVGrabber::SetComp()\n"); */

    int w = NTSC_WIDTH / x_decimate_;
    int h = NTSC_HEIGHT / y_decimate_;
    if (w != inw_ || h != inh_) {
	setsize(w, h);
    }

    if( bmh == 0 )
      fprintf(stderr,"Bitmap infoheader pointer is null\n"); /* Uh oh! */
    else {
	memset(bmh, 0, sizeof(*bmh));
	bmh->b.bmi.biSize = sizeof(BITMAPINFOHEADER);
	bmh->b.bmi.biWidth = inw_;
	bmh->b.bmi.biHeight = inh_;
	bmh->b.bmi.biPlanes = 1;
	bmh->b.bmi.biBitCount = 16;
	bmh->b.bmi.biCompression = BICOMP_DECYUVDIB;
    }
}
Пример #30
0
void DirectShowGrabber::start() {
   HRESULT hr;

   basewidth_  = NTSC_BASE_WIDTH;
   baseheight_ = NTSC_BASE_HEIGHT;
   max_fps_    = 30;
   setsize();

   // callback mutex
   cb_mutex_ = CreateMutex(NULL, FALSE, NULL);
   WaitForSingleObject(cb_mutex_, INFINITE);
   
   capturing_  = 1;   
   last_frame_ = NULL;

   debug_msg("DirectShowGrabber::start():  starting capture graph...\n");

   // Run the graph...
   hr = pMediaControl_->Run();
   //showErrorMessage(hr);

   Grabber::start();
}