• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ EDICT_TO_PROG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SV_TouchLinks

/*
====================
SV_TouchLinks
====================
*/
void SV_TouchLinks ( edict_t *ent, areanode_t *node )
{
	int			i, numtouch;
	edict_t		*touchlist[MAX_EDICTS], *touch;
	int			old_self, old_other;

	numtouch = SV_AreaEdicts (ent->v.absmin, ent->v.absmax, touchlist, MAX_EDICTS, AREA_TRIGGERS);

// touch linked edicts
	for (i = 0; i < numtouch; i++)
	{
		touch = touchlist[i];
		if (touch == ent)
			continue;
		if (!touch->v.touch || touch->v.solid != SOLID_TRIGGER)
			continue;

		old_self = pr_global_struct->self;
		old_other = pr_global_struct->other;

		pr_global_struct->self = EDICT_TO_PROG(touch);
		pr_global_struct->other = EDICT_TO_PROG(ent);
		pr_global_struct->time = sv.time;
		PR_ExecuteProgram (touch->v.touch);

		pr_global_struct->self = old_self;
		pr_global_struct->other = old_other;
	}
}
开发者ID:luaman,项目名称:zq,代码行数:34,代码来源:sv_world.cpp


示例2: SV_Physics

/*
================
SV_Physics

================
*/
void SV_Physics (void)
{
	int		i;
	edict_t	*ent;

// let the progs know that a new frame has started
	pr_global_struct->self = ((int)EDICT_TO_PROG(sv.edicts));
	pr_global_struct->other = ((int)EDICT_TO_PROG(sv.edicts));
	pr_global_struct->time = sv.time;
	PR_ExecuteProgram (pr_global_struct->StartFrame);

//SV_CheckAllEnts ();

//
// treat each object in turn
//
	ent = sv.edicts;
	for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
	{
		if (ent->free)
			continue;

		if (pr_global_struct->force_retouch)
		{
			SV_LinkEdict (ent, true);	// force retouch even for stationary
		}

		if (i > 0 && i <= svs.maxclients)
			SV_Physics_Client (ent, i);
		else if (ent->v.movetype == MOVETYPE_PUSH)
			SV_Physics_Pusher (ent);
		else if (ent->v.movetype == MOVETYPE_FAKEPUSH)
			SV_Physics_FakePusher (ent);
		else if (ent->v.movetype == MOVETYPE_NONE)
			SV_Physics_None (ent);
#ifdef QUAKE2
		else if (ent->v.movetype == MOVETYPE_FOLLOW)
			SV_Physics_Follow (ent);
#endif
		else if (ent->v.movetype == MOVETYPE_NOCLIP)
			SV_Physics_Noclip (ent);
		else if (ent->v.movetype == MOVETYPE_STEP)
			SV_Physics_Step (ent);
		else if (ent->v.movetype == MOVETYPE_TOSS 
		|| ent->v.movetype == MOVETYPE_BOUNCE
#ifdef QUAKE2
		|| ent->v.movetype == MOVETYPE_BOUNCEMISSILE
#endif
		|| ent->v.movetype == MOVETYPE_FLY
		|| ent->v.movetype == MOVETYPE_FLYMISSILE)
			SV_Physics_Toss (ent);
		else
			Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype);			
	}
	
	if (pr_global_struct->force_retouch)
		pr_global_struct->force_retouch--;	

	sv.time += host_frametime;
}
开发者ID:MaddTheSane,项目名称:TenebraeQuake,代码行数:66,代码来源:sv_phys.c


示例3: SV_PTrack_f

void SV_PTrack_f (void)
{
	int		i;
	edict_t *ent, *tent;
	
	if (!host_client->spectator)
		return;

	if (Cmd_Argc() != 2)
	{
		// turn off tracking
		host_client->spec_track = 0;
		ent = EDICT_NUM(host_client - svs.clients + 1);
		tent = EDICT_NUM(0);
		ent->v.goalentity = EDICT_TO_PROG(tent);
		return;
	}
	
	i = atoi(Cmd_Argv(1));
	if (i < 0 || i >= MAX_CLIENTS || svs.clients[i].state != cs_spawned ||
		svs.clients[i].spectator) {
		SV_ClientPrintf (host_client, PRINT_HIGH, "Invalid client to track\n");
		host_client->spec_track = 0;
		ent = EDICT_NUM(host_client - svs.clients + 1);
		tent = EDICT_NUM(0);
		ent->v.goalentity = EDICT_TO_PROG(tent);
		return;
	}
	host_client->spec_track = i + 1; // now tracking

	ent = EDICT_NUM(host_client - svs.clients + 1);
	tent = EDICT_NUM(i + 1);
	ent->v.goalentity = EDICT_TO_PROG(tent);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:34,代码来源:sv_user.c


示例4: Sentry_FindTarget_Angel

int Sentry_FindTarget_Angel(  )
{
    gedict_t *client;
    gedict_t *enemy = PROG_TO_EDICT( self->s.v.enemy );

    if ( enemy != world )
    {
        if ( CheckTarget( enemy ) )
        {
            if ( g_globalvars.time > self->height )
            {
                Sentry_FoundTarget(  );
                return 1;
            } else
                return 0;
        }
    }
    for ( client = world; (client = trap_find( client, FOFS( s.v.classname ), "player" )); )
    {
        if ( CheckTarget( client ) )
        {
            self->s.v.enemy = EDICT_TO_PROG( client );
            self->height = g_globalvars.time + 0.1 * ( int ) ( g_random(  ) * tfset_sgppl );
            //     self.height = g_globalvars.time + 0.1 * Q_rint(sgppl);
            if ( self->height == g_globalvars.time )
            {
                Sentry_FoundTarget(  );
                return 1;
            }
            return 0;
        }
    }
    self->s.v.enemy = EDICT_TO_PROG( world );
    return 0;
}
开发者ID:angeld29,项目名称:TF2003-qvm,代码行数:35,代码来源:sentry.c


示例5: Sentry_FindTarget

int Sentry_FindTarget(  )
{
    gedict_t *client;
    float   r;
    float   gotone;
    float   loopc;

    r = 0;
    loopc = 0;
    gotone = 0;
    while ( loopc < 6 && !gotone )
    {
        client = checkclient(  );
        gotone = CheckTarget( client );
        loopc = loopc + 1;
    }
    if ( !gotone )
        return 0;
    self->s.v.enemy = EDICT_TO_PROG( client );
    if ( strneq( PROG_TO_EDICT( self->s.v.enemy )->s.v.classname, "player" ) )
    {
        self->s.v.enemy = PROG_TO_EDICT( self->s.v.enemy )->s.v.enemy;
        if ( strneq( PROG_TO_EDICT( self->s.v.enemy )->s.v.classname, "player" ) )
        {
            self->s.v.enemy = EDICT_TO_PROG( world );
            return 0;
        }
    }
    Sentry_FoundTarget(  );
    return 1;
}
开发者ID:angeld29,项目名称:TF2003-qvm,代码行数:31,代码来源:sentry.c


示例6: T_Dispenser

//=========================================================================
// Dispenser Touch function. Allows players to get stuff from the Dispenser.
void T_Dispenser(  )
{
    gedict_t *dist_checker;

    if ( strneq( other->s.v.classname, "player" ) )
	return;

    if ( other->team_no && !TeamFortress_isTeamsAllied (other->team_no , self->team_no) )
	CenterPrint( self->real_owner, "Enemies are using your dispenser!\n" );

    // Ignore any engineer working on this dispenser	
    if ( ( !other->building || other->building == world ) && other->building_wait < g_globalvars.time )
    {
        // Pop up the menu
	other->current_menu = MENU_DISPENSER;
	other->menu_count = MENU_REFRESH_RATE;

	other->building = self;

        // Start a Distance checker, which removes the menu if the player
	// gets too far away from the Dispenser.
	dist_checker = spawn(  );
	dist_checker->s.v.classname = "timer";
	dist_checker->s.v.owner = EDICT_TO_PROG( other );
	dist_checker->s.v.enemy = EDICT_TO_PROG( self );
	dist_checker->s.v.think = ( func_t ) CheckDistance;
	dist_checker->s.v.nextthink = g_globalvars.time + 0.3;
    }
}
开发者ID:MrPnut,项目名称:QHome,代码行数:31,代码来源:engineer.c


示例7: SV_RunThink

/*
=============
SV_RunThink

Runs thinking code if time.  There is some play in the exact time the think
function will be called, because it is called before any movement is done
in a frame.  Not used for pushmove objects, because they must be exact.
Returns false if the entity removed itself.
=============
*/
qboolean SV_RunThink (edict_t *ent)
{
	float	thinktime;

	do
	{
		thinktime = ent->v.nextthink;
		if (thinktime <= 0)
			return true;
		if (thinktime > sv.time + host_frametime)
			return true;
		
		if (thinktime < sv.time)
			thinktime = sv.time;	// don't let things stay in the past.
									// it is possible to start that way
									// by a trigger with a local time.
		ent->v.nextthink = 0;
		pr_global_struct->time = thinktime;
		pr_global_struct->self = EDICT_TO_PROG(ent);
		pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
		PR_ExecuteProgram (ent->v.think);

		if (ent->free)
			return false;
	} while (1);

	return true;
}
开发者ID:ACIIL,项目名称:Quake,代码行数:38,代码来源:sv_phys.c


示例8: SV_Physics_Pusher

/*
================
SV_Physics_Pusher

================
*/
void SV_Physics_Pusher (edict_t *ent)
{
	float	thinktime;
	float	oldltime;
	float	movetime;

	oldltime = ent->v.ltime;
	
	thinktime = ent->v.nextthink;
	if (thinktime < ent->v.ltime + host_frametime)
	{
		movetime = thinktime - ent->v.ltime;
		if (movetime < 0)
			movetime = 0;
	}
	else
		movetime = host_frametime;

	if (movetime)
	{
		SV_PushMove (ent, movetime);	// advances ent->v.ltime if not blocked
	}
		
	if (thinktime > oldltime && thinktime <= ent->v.ltime)
	{
		ent->v.nextthink = 0;
		pr_global_struct->time = sv.time;
		pr_global_struct->self = EDICT_TO_PROG(ent);
		pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
		PR_ExecuteProgram (ent->v.think);
		if (ent->free)
			return;
	}

}
开发者ID:tyabus,项目名称:quake-leak,代码行数:41,代码来源:sv_phys.c


示例9: LaunchLaser

void LaunchLaser( vec3_t org, vec3_t vec )
{

	if ( !strcmp( self->s.v.classname, "monster_enforcer" ) )
		sound( self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM );

	normalize( vec, vec );

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

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

	setorigin( newmis, PASSVEC3( org ) );

	//newmis->s.v.velocity = vec * 600;
	VectorScale( vec, 600, newmis->s.v.velocity );

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

	newmis->s.v.nextthink = g_globalvars.time + 5;
	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.touch = ( func_t ) Laser_Touch;
}
开发者ID:angeld29,项目名称:TF2003-qvm,代码行数:29,代码来源:misc.c


示例10: SV_RemoveBot

void SV_RemoveBot (client_t *cl)
{
	if (cl->state == cs_spawned)
	{
		if (!cl->spectator)
		{
			// call the prog function for removing a client
			// this will set the body to a dead frame, among other things
			pr_global_struct->self = EDICT_TO_PROG(cl->edict);
			PR_ExecuteProgram (PR_GLOBAL(ClientDisconnect));
		}
		else if (SpectatorDisconnect)
		{
			// call the prog function for removing a client
			// this will set the body to a dead frame, among other things
			pr_global_struct->self = EDICT_TO_PROG(cl->edict);
			PR_ExecuteProgram (SpectatorDisconnect);
		}
	}

	Com_DPrintf ("Bot %s removed\n", cl->name.c_str());

	cl->state = cs_free;		// we don't have zombie bots :)
	cl->bot = false;
	cl->old_frags = 0;
	cl->name = "";
//	cl->edict->inuse = false;
	cl->edict->v.frags = 0;
	cl->userinfo.clear();

	SV_FreeDelayedPackets (cl);

// send notification to all remaining clients
	SV_FullClientUpdate (cl, &sv.reliable_datagram);
}
开发者ID:luaman,项目名称:zq,代码行数:35,代码来源:sv_bot.cpp


示例11: set_move_trace

void set_move_trace(trace_t *trace)
{
	if (is_progdefs111)
	{
		pr_global_struct_v111->trace_allsolid = trace->allsolid;
		pr_global_struct_v111->trace_startsolid = trace->startsolid;
		pr_global_struct_v111->trace_fraction = trace->fraction;
		pr_global_struct_v111->trace_inwater = trace->inwater;
		pr_global_struct_v111->trace_inopen = trace->inopen;
		VectorCopy (trace->endpos, pr_global_struct_v111->trace_endpos);
		VectorCopy (trace->plane.normal, pr_global_struct_v111->trace_plane_normal);
		pr_global_struct_v111->trace_plane_dist =  trace->plane.dist;
		if (trace->ent)
			pr_global_struct_v111->trace_ent = EDICT_TO_PROG(trace->ent);
		else
			pr_global_struct_v111->trace_ent = EDICT_TO_PROG(sv.edicts);

		return;
	}

	pr_global_struct->trace_allsolid = trace->allsolid;
	pr_global_struct->trace_startsolid = trace->startsolid;
	pr_global_struct->trace_fraction = trace->fraction;
	pr_global_struct->trace_inwater = trace->inwater;
	pr_global_struct->trace_inopen = trace->inopen;
	VectorCopy (trace->endpos, pr_global_struct->trace_endpos);
	VectorCopy (trace->plane.normal, pr_global_struct->trace_plane_normal);
	pr_global_struct->trace_plane_dist =  trace->plane.dist;	
	if (trace->ent)
		pr_global_struct->trace_ent = EDICT_TO_PROG(trace->ent);
	else
		pr_global_struct->trace_ent = EDICT_TO_PROG(sv.edicts);
}
开发者ID:bazilio-ua,项目名称:fxhexen2,代码行数:33,代码来源:sv_move.c


示例12: Bot_Spawn_And_Begin

// called every time when adding a bot or bringing the bot from previous map
void Bot_Spawn_And_Begin (client_t *cl)
{
	int i;
	edict_t	*ent = cl->edict;

	// set colormap, name, entgravity and maxspeed
	SetUpClientEdict (cl, ent);

	cl->state = cs_spawned;

	// copy spawn parms out of the client_t
	for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
		(&PR_GLOBAL(parm1))[i] = cl->spawn_parms[i];

	// call the spawn function
	pr_global_struct->time = sv.time;
	pr_global_struct->self = EDICT_TO_PROG(ent);
	PR_ExecuteProgram (PR_GLOBAL(ClientConnect));

	// actually spawn the player
	pr_global_struct->time = sv.time;
	pr_global_struct->self = EDICT_TO_PROG(ent);
	PR_ExecuteProgram (PR_GLOBAL(PutClientInServer));

	cl->sendinfo = true;
}
开发者ID:luaman,项目名称:zq,代码行数:27,代码来源:sv_bot.cpp


示例13: SV_Impact

/*
==================
SV_Impact

Two entities have touched, so run their touch functions
==================
*/
void SV_Impact (edict_t *e1, edict_t *e2)
{
	int		old_self, old_other;
	
	old_self = pr_global_struct->self;
	old_other = pr_global_struct->other;
	
	pr_global_struct->time = sv.time;
	if (e1->v.touch && e1->v.solid != SOLID_NOT)
	{
		pr_global_struct->self = ((int)EDICT_TO_PROG(e1));
		pr_global_struct->other = ((int)EDICT_TO_PROG(e2));
		PR_ExecuteProgram (e1->v.touch);
	}
	
	if (e2->v.touch && e2->v.solid != SOLID_NOT)
	{
		pr_global_struct->self = ((int)EDICT_TO_PROG(e2));
		pr_global_struct->other = ((int)EDICT_TO_PROG(e1));
		PR_ExecuteProgram (e2->v.touch);
	}

	pr_global_struct->self = old_self;
	pr_global_struct->other = old_other;
}
开发者ID:MaddTheSane,项目名称:TenebraeQuake,代码行数:32,代码来源:sv_phys.c


示例14: SV_Impact

/*
==================
SV_Impact

Two entities have touched, so run their touch functions
==================
*/
void SV_Impact (edict_t *e1, edict_t *e2)
{
	int	old_self, old_other;
	
	old_self = PR_GLOBAL(self);
	old_other = PR_GLOBAL(other);
	
	PR_GLOBAL(time) = sv.time;
	if (e1->v.touch && e1->v.solid != SOLID_NOT)
	{
		PR_GLOBAL(self) = EDICT_TO_PROG(e1);
		PR_GLOBAL(other) = EDICT_TO_PROG(e2);
		PR_ExecuteProgram (e1->v.touch);
	}
	
	if (e2->v.touch && e2->v.solid != SOLID_NOT)
	{
		PR_GLOBAL(self) = EDICT_TO_PROG(e2);
		PR_GLOBAL(other) = EDICT_TO_PROG(e1);
		PR_ExecuteProgram (e2->v.touch);
	}

	PR_GLOBAL(self) = old_self;
	PR_GLOBAL(other) = old_other;
}
开发者ID:SpiritQuaddicted,项目名称:reQuiem,代码行数:32,代码来源:sv_phys.c


示例15: Engineer_UseSentryGun

//=========================================================================
// Engineer has used a Spanner on the SentryGun
void Engineer_UseSentryGun( gedict_t * gun )
{
    gedict_t *dist_checker;

    G_sprint( self, 2, "Level %.0f Sentry Gun has %.0f health, %.0f shells",
	      gun->s.v.weapon, gun->s.v.health, gun->s.v.ammo_shells );
    if ( gun->s.v.weapon == 3 )
    {
	G_sprint( self, 2, ", %.0f rockets", gun->s.v.ammo_rockets );
    }

    if ( gun->has_sentry &&  tg_data.tg_enabled )
	G_sprint( self, 2, ", static" );

    G_sprint( self, 2, "\n" );
    self->current_menu = MENU_ENGINEER_FIX_SENTRYGUN;
    self->menu_count = MENU_REFRESH_RATE;
    self->building = gun;
    dist_checker = spawn(  );
    dist_checker->s.v.classname = "timer";
    dist_checker->s.v.owner = EDICT_TO_PROG( self );
    dist_checker->s.v.enemy = EDICT_TO_PROG( gun );
    dist_checker->s.v.think = ( func_t ) CheckDistance;
    dist_checker->s.v.nextthink = g_globalvars.time + 0.3;
}
开发者ID:MrPnut,项目名称:QHome,代码行数:27,代码来源:engineer.c


示例16: SV_ProgStartFrame

void SV_ProgStartFrame (void)
{
// let the progs know that a new frame has started
	pr_global_struct->self = EDICT_TO_PROG(sv.edicts);
	pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
	pr_global_struct->time = sv.time;
	PR_ExecuteProgram (pr_global_struct->StartFrame);
}
开发者ID:ACIIL,项目名称:Quake,代码行数:8,代码来源:sv_phys.c


示例17: BuildChain

//
// BuildChain - Builds the chain (linked list)
//
void BuildChain()
{
    self->s.v.goalentity = EDICT_TO_PROG( MakeLink() );
    PROG_TO_EDICT( self->s.v.goalentity )->s.v.think = (func_t) UpdateChain;
    PROG_TO_EDICT( self->s.v.goalentity )->s.v.nextthink = g_globalvars.time + 0.1;
    PROG_TO_EDICT( self->s.v.goalentity )->s.v.owner = self->s.v.owner;
    PROG_TO_EDICT( self->s.v.goalentity )->s.v.goalentity = EDICT_TO_PROG( MakeLink() );
    PROG_TO_EDICT( PROG_TO_EDICT( self->s.v.goalentity )->s.v.goalentity)->s.v.goalentity = EDICT_TO_PROG( MakeLink() );
}
开发者ID:JosephPecoraro,项目名称:ktx,代码行数:12,代码来源:grapple.c


示例18: SV_DropClient

/*
=====================
SV_DropClient

Called when the player is totally leaving the server, either willingly
or unwillingly.  This is NOT called if the entire server is quiting
or crashing.
=====================
*/
void SV_DropClient (client_t *drop)
{
	// add the disconnect
	MSG_WriteByte (&drop->netchan.message, svc_disconnect);

	if (drop->state == cs_spawned)
	{
		if (!drop->spectator)
		{
			// call the prog function for removing a client
			// this will set the body to a dead frame, among other things
			pr_global_struct->self = EDICT_TO_PROG(drop->edict);
			PR_ExecuteProgram (pr_global_struct->ClientDisconnect);
		}
		else if (SpectatorDisconnect)
		{
			// call the prog function for removing a client
			// this will set the body to a dead frame, among other things
			pr_global_struct->self = EDICT_TO_PROG(drop->edict);
			PR_ExecuteProgram (SpectatorDisconnect);
		}
	}
	else if (dmMode.integer == DM_SIEGE)
	{
		if (PR_GetString(drop->edict->v.puzzle_inv1)[0] != '\0')
		{
			// this guy has a puzzle piece, call this function anyway
			// to make sure he leaves it behind
			Con_Printf("Client in unspawned state had puzzle piece, forcing drop\n");
			pr_global_struct->self = EDICT_TO_PROG(drop->edict);
			PR_ExecuteProgram (pr_global_struct->ClientDisconnect);
		}
	}

	if (drop->spectator)
		Con_Printf ("Spectator %s removed\n",drop->name);
	else
		Con_Printf ("Client %s removed\n",drop->name);

	if (drop->download)
	{
		fclose (drop->download);
		drop->download = NULL;
	}

	drop->state = cs_zombie;		// become free in a few seconds
	drop->connection_started = realtime;	// for zombie timeout

	drop->old_frags = 0;
	drop->edict->v.frags = 0;
	drop->name[0] = 0;
	memset (drop->userinfo, 0, sizeof(drop->userinfo));

	// send notification to all remaining clients
	SV_FullClientUpdate (drop, &sv.reliable_datagram);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:65,代码来源:sv_main.c


示例19: SV_Physics_Client

/*	Player character actions
*/
void SV_Physics_Client (edict_t	*ent, int num)
{
	if(!svs.clients[num-1].active)
		return;		// unconnected slot

	// call standard client pre-think
	pr_global_struct.self = EDICT_TO_PROG(ent);

	Game->Game_Init(SERVER_PLAYERPRETHINK,ent,sv.time);

	Game->Physics_CheckVelocity(ent);

	// decide which move function to call
	switch(ent->v.movetype)
	{
	case MOVETYPE_NONE:
		if (!Server_RunThink(ent))
			return;
		break;
	case MOVETYPE_WALK:
		if(!Server_RunThink(ent))
			return;

		if(!Physics_CheckWater(ent) && !(ent->v.flags & FL_WATERJUMP))
			Game->Physics_SetGravity(ent);

		SV_CheckStuck (ent);
		SV_WalkMove (ent);
		break;
	case MOVETYPE_TOSS:
	case MOVETYPE_BOUNCE:
	case MOVETYPE_FLYBOUNCE:
		Physics_Toss(ent);
		break;
	case MOVETYPE_FLY:
		if(!Server_RunThink(ent))
			return;

		SV_FlyMove(ent,host_frametime,NULL);
		break;
	case MOVETYPE_NOCLIP:
		if(!Server_RunThink(ent))
			return;
		Math_VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin);
		break;
	default:
		Sys_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype);
	}

	// Call standard player post-think
	SV_LinkEdict(ent,true);

	pr_global_struct.self = EDICT_TO_PROG(ent);

	Game->Game_Init(SERVER_CLIENTPOSTTHINK,ent,sv.time);
}
开发者ID:Acidburn0zzz,项目名称:KatanaEngine,代码行数:58,代码来源:engine_physics.c


示例20: SV_RunThink

/*
=============
SV_RunThink

Runs thinking code if time.  There is some play in the exact time the think
function will be called, because it is called before any movement is done
in a frame.  Not used for pushmove objects, because they must be exact.
Returns false if the entity removed itself.
=============
*/
qboolean SV_RunThink (edict_t *ent)
{
	float	thinktime;
	int		oldcount;

	thinktime = ent->v.nextthink;
	if (thinktime <= 0 || thinktime > sv.time + host_frametime)
		return true;
		
	if (thinktime < sv.time)
		thinktime = sv.time;	// don't let things stay in the past.
								// it is possible to start that way
								// by a trigger with a local time.
	ent->v.nextthink = 0;

	PR_GLOBAL(time) = thinktime;
	PR_GLOBAL(self) = EDICT_TO_PROG(ent);
	PR_GLOBAL(other) = EDICT_TO_PROG(sv.edicts);

// JDH: the extra 1 added to total_monsters by monster_fish happens 
//      in swimmonster_start_go, during the first frame (sv.time = 1). 
//      But fix it only if total_monsters was increased when fish were 
//      spawned (ie. if sv.fish_counted is true)

	if ((sv.time == 1.0) && sv_fishfix.value && sv.fish_counted && 
		!strcmp(pr_strings + ent->v.classname, "monster_fish") &&
		!strcmp(pr_functions[ent->v.think].s_name, "swimmonster_start_go"))
	{
		oldcount = PR_GLOBAL(total_monsters);		
	}
	else oldcount = -1;
	
	PR_ExecuteProgram (ent->v.think);
	
	if (oldcount != -1)
	{
		if ((int)PR_GLOBAL(total_monsters) - oldcount == 1)
		{
			PR_GLOBAL(total_monsters) -= 1;
			if (sv.fish_counted == 1)
			{
				Con_Print ("Detected fish-count bug in progs.dat; monster count has been adjusted\n");
				sv.fish_counted++;
			}
		}
	}

	return !ent->free;
}
开发者ID:SpiritQuaddicted,项目名称:reQuiem,代码行数:59,代码来源:sv_phys.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ EDITOR_DEF函数代码示例发布时间:2022-05-30
下一篇:
C++ EDGE_COUNT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap