nomonsters

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

nomonsters

Post by r00k »

I was bored so I turn the nomonsters cvar into something useable. Monsters spawn on the map but do nothing, and take no damage.
bind this to a key like bind mouse2 "toggle nomonsters" and u can freezetime walkaround unfreezetime and play on ;)

find this function, then find where i put nomonsters. done.

Code: Select all

void SV_Physics (void)
Then in the for loop

Code: Select all

	for (i = 0 ; i < cap_edicts ; i++, ent = NEXT_EDICT(ent))
	{
		if (ent->free)
			continue;

		if (nomonsters.value)
		{
			if (ent->v.flags == FL_MONSTER)
				continue;
			if (ent->v.movetype == MOVETYPE_STEP)
				continue;			
		}
>>>>>>> D E M O <<<<<<<<<<<<<<
Image
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: nomonsters

Post by qbism »

... d r e d g e ...

Great idea. It could go one more step and freeze all physics except player. Here's the concept--
Create 'sv_freezephysics' cvar. It should be treated as a cheat if sv_cheats is supported.

_Host_Frame: Don't let lights decay

Code: Select all

        if (!sv_freezephysics.value || !sv_cheats.value)
            CL_DecayLights ();
R_Push_Dlights: Don't kill off dynamic lights

Code: Select all

      if ((l->die < cl.time && (!sv_freezephysics.value || !sv_cheats.value)) || (l->radius <= 0))
         continue;
R_DrawParticles: Freeze particle motion and deny decay (decay catches up after unfreeze).

Code: Select all

    if (!sv_freezephysics.value || !sv_cheats.value) //qb
        for ( ;; )
        {
            kill = active_particles;
...

    for (p=active_particles ; p ; p=p->next)
    {
        if (!sv_freezephysics.value || !sv_cheats.value) //qb
            for ( ;; )
            {
                kill = p->next;
                if (kill && kill->die < cl.time)
...

        if (!sv_freezephysics.value || !sv_cheats.value)
        {
            p->org[0] += p->vel[0] * frametime;
SV_Physics: Your engine may use a switch statement, or if-else:

Code: Select all

        if (i > 0 && i <= svs.maxclients)
        {
            SV_Physics_Client (ent, i);
        }
        else if (!sv_freezephysics.value || !sv_cheats.value) //freeze everything but players
            switch ((int) ent->v.movetype)
            {
            case MOVETYPE_PUSH:
                SV_Physics_Pusher (ent);
                break;
...
Post Reply