Esempio n. 1
0
/*
** SV_RunNQNewmis
**
** sv_player will be valid
*/
void SV_RunNQNewmis (void)
{
    edict_t	*ent;
    double save_frametime;
    int i, pl;

    pl = EDICT_TO_PROG(sv_player);
    ent = NEXT_EDICT(sv.edicts);
    for (i=1 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
    {
        if (!ent->inuse)
            continue;
        if (ent->lastruntime || ent->v.owner != pl)
            continue;
        if (ent->v.movetype != MOVETYPE_FLY &&
                ent->v.movetype != MOVETYPE_FLYMISSILE &&
                ent->v.movetype != MOVETYPE_BOUNCE)
            continue;
        if (ent->v.solid != SOLID_BBOX && ent->v.solid != SOLID_TRIGGER)
            continue;

        save_frametime = sv_frametime;
        sv_frametime = 0.05;
        SV_RunEntity (ent);
        sv_frametime = save_frametime;
        return;
    }
}
Esempio n. 2
0
/*
================
SV_RunNewmis

================
*/
void SV_RunNewmis (void)
{
	edict_t	*ent;

	if (!pr_global_struct->newmis)
		return;
	ent = PROG_TO_EDICT(pr_global_struct->newmis);
	host_frametime = 0.05;
	pr_global_struct->newmis = 0;
	
	SV_RunEntity (ent);		
}
Esempio n. 3
0
/*
================
SV_Physics

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

    if (sv.state != ss_game)
        return;

    if (sv.old_time)
    {
        // don't bother running a frame if sv_mintic seconds haven't passed
        sv_frametime = sv.time - sv.old_time;
        if (sv_frametime < sv_mintic.value)
            return;
        if (sv_frametime > sv_maxtic.value)
            sv_frametime = sv_maxtic.value;
        sv.old_time = sv.time;
    }
    else
        sv_frametime = 0.1;		// initialization frame

    if (pr_nqprogs)
        NQP_Reset ();

    PR_GLOBAL(frametime) = sv_frametime;

    SV_ProgStartFrame ();

//
// treat each object in turn
// even the world gets a chance to think
//
    ent = sv.edicts;
    for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
    {
        if (!ent->inuse)
            continue;

        if (PR_GLOBAL(force_retouch))
            SV_LinkEdict (ent, true);	// force retouch even for stationary

        if (i > 0 && i <= MAX_CLIENTS)
            continue;		// clients are run directly from packets

        SV_RunEntity (ent);
        SV_RunNewmis ();
    }

    if (PR_GLOBAL(force_retouch))
        PR_GLOBAL(force_retouch)--;

    SV_RunBots ();
}
Esempio n. 4
0
/*
================
SV_Physics

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

// don't bother running a frame if sys_ticrate seconds haven't passed
	host_frametime = realtime - old_time;
	if (host_frametime < sv_mintic.value)
		return;
	if (host_frametime > sv_maxtic.value)
		host_frametime = sv_maxtic.value;
	old_time = realtime;

	pr_global_struct->frametime = host_frametime;

	SV_ProgStartFrame ();

//
// treat each object in turn
// even the world gets a chance to think
//
	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 <= MAX_CLIENTS)
			continue;		// clients are run directly from packets

		SV_RunEntity (ent);
		SV_RunNewmis ();
	}
	
	if (pr_global_struct->force_retouch)
		pr_global_struct->force_retouch--;	
}
Esempio n. 5
0
/*
================
SV_RunNewmis
================
*/
void SV_RunNewmis (void)
{
    edict_t	*ent;
    double save_frametime;

    if (pr_nqprogs)
        return;

    if (!pr_global_struct->newmis)
        return;

    ent = PROG_TO_EDICT(pr_global_struct->newmis);
    pr_global_struct->newmis = 0;

    save_frametime = sv_frametime;
    sv_frametime = 0.05;

    SV_RunEntity (ent);

    sv_frametime = save_frametime;
}
Esempio n. 6
0
/*
================
SV_Physics

================
*/
void SV_Physics (void)
{
    int		i;
    static double	old_time;
    byte *ent_global_ptr = (byte *) sv.edicts;

    DEBUGPRINT(PHYSICS,MEDIUM) printf("GAJA: In Physics parallel\n");

    // don't bother running a frame if sys_ticrate seconds haven't passed
    host_frametime = realtime - old_time;
    if (host_frametime < sv_mintic.value)
        return;
    if (host_frametime > sv_maxtic.value)
        host_frametime = sv_maxtic.value;
    old_time = realtime;

    pr_global_struct->frametime = host_frametime;

    SV_ProgStartFrame ();

    //
    // treat each object in turn
    // even the world gets a chance to think
    //

    if (pr_global_struct->force_retouch)
    {
        // GAJA: RUN SERIAL
        edict_t *ent;
        ent = sv.edicts;
        for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
        {
            if (ent->free)
                continue;

            SV_LinkEdict (ent, true); // force retouch even for stationary

            if (i > 0 && i <= MAX_CLIENTS)
                continue;   // clients are run directly from packets

            SV_RunEntity (ent);
            SV_RunNewmis ();
        }
    }
    else
    {
        // GAJA: RUN PARALLEL
        omp_set_num_threads(NoThreads);

        #pragma omp parallel for schedule(dynamic,1) private(i) shared(svs, sv, sv_areanodes, pr_global_struct, realtime, movevars) 
        for (i=0 ; i<sv.num_edicts ; i++)
        {
            edict_t *ent = (edict_t *) (ent_global_ptr + pr_edict_size * i);

            if (ent->free || i <= MAX_CLIENTS)
                continue;

            DEBUGPRINT(PHYSICS,HIGH) printf("Thread= %d\t\tBefore Transaction\n", omp_get_thread_num());

            inTransaction = true;

            // ~+~+~+~+~+
            // StartTransaction
            LOCK(global_lock)
            TRANSACTION

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

                //if (i > MAX_CLIENTS)	// don't run client entities (clients are run directly from packets)
 			    //{
                SV_RunEntity (ent);
                SV_RunNewmis ();
                //}

            TRANSACTION_END 
            UNLOCK(global_lock)
            // EndTransaction

            inTransaction = false;

            DEBUGPRINT(PHYSICS,HIGH) printf("Thread= %d\t\tAfter Transaction\n", omp_get_thread_num());


            // send messages and packets generated during transaction
            FlushTMOutput();
        } // end for

    } //end if


    if (pr_global_struct->force_retouch)
        pr_global_struct->force_retouch--;	
}