pmodel fixes (now works properly in listen/singleplayer)
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Aug 2000 12:32:44 +0000 (12:32 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Aug 2000 12:32:44 +0000 (12:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@14 d7cf8633-e32d-0410-b094-e92efae38249

chase.c
cl_input.c
cl_main.c
host.c
host_cmd.c
server.h

diff --git a/chase.c b/chase.c
index 1831a98..f89a5d6 100644 (file)
--- a/chase.c
+++ b/chase.c
@@ -42,19 +42,15 @@ qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec
 
 void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
 {
+       /*
        trace_t trace;
 
        memset (&trace, 0, sizeof(trace));
        SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
 
-       if (trace.fraction < 1)
-       {
-               VectorCopy (trace.endpos, impact);
-       }
-       else
-       {
-               VectorCopy (end, impact);
-       }
+       VectorCopy (trace.endpos, impact);
+       */
+       VectorCopy (end, impact);
 }
 
 void Chase_Update (void)
index 305bc22..a4a7e4d 100644 (file)
@@ -351,7 +351,7 @@ void CL_SendMove (usercmd_t *cmd)
        upmove += cmd->upmove;
        total++;
        // LordHavoc: cap outgoing movement messages to sys_ticrate
-       if (realtime - lastmovetime < sys_ticrate.value)
+       if (cl.maxclients > 1 && realtime - lastmovetime < sys_ticrate.value)
                return;
        lastmovetime = realtime;
        // average what has happened during this time
index 0a9d387..af1b4a0 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -199,18 +199,18 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
                break;
                
        case 2:
-               if (cl_pmodel.value)
-               {
-                       MSG_WriteByte (&cls.message, clc_stringcmd);
-                       MSG_WriteString (&cls.message, va("pmodel %f\n", cl_pmodel.value));
-               }
-
                MSG_WriteByte (&cls.message, clc_stringcmd);
                MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
 
                MSG_WriteByte (&cls.message, clc_stringcmd);
                MSG_WriteString (&cls.message, va("color %i %i\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
        
+               if (cl_pmodel.value)
+               {
+                       MSG_WriteByte (&cls.message, clc_stringcmd);
+                       MSG_WriteString (&cls.message, va("pmodel %f\n", cl_pmodel.value));
+               }
+
                MSG_WriteByte (&cls.message, clc_stringcmd);
                sprintf (str, "spawn %s", cls.spawnparms);
                MSG_WriteString (&cls.message, str);
@@ -779,6 +779,39 @@ void CL_PauseDemo_f (void)
                Con_Printf("Demo unpaused\n");
 }
 
+/*
+======================
+CL_PModel_f
+LordHavoc: Intended for Nehahra, I personally think this is dumb, but Mindcrime won't listen.
+======================
+*/
+void CL_PModel_f (void)
+{
+       int i;
+       eval_t *val;
+
+       if (Cmd_Argc () == 1)
+       {
+               Con_Printf ("\"pmodel\" is \"%s\"\n", cl_pmodel.string);
+               return;
+       }
+       i = atoi(Cmd_Argv(1));
+
+       if (cmd_source == src_command)
+       {
+               if (cl_pmodel.value == i)
+                       return;
+               Cvar_SetValue ("_cl_pmodel", i);
+               if (cls.state == ca_connected)
+                       Cmd_ForwardToServer ();
+               return;
+       }
+
+       host_client->pmodel = i;
+       if (val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel))
+               val->_float = i;
+}
+
 cvar_t demo_nehahra = {"demo_nehahra", "0"};
 
 /*
@@ -829,6 +862,8 @@ void CL_Init (void)
 
        // LordHavoc: added pausedemo
        Cmd_AddCommand ("pausedemo", CL_PauseDemo_f);
+       // LordHavoc: added pmodel command (like name, etc, only intended for Nehahra)
+       Cmd_AddCommand ("pmodel", CL_PModel_f);
        // LordHavoc: added demo_nehahra cvar
        Cvar_RegisterVariable (&demo_nehahra);
        if (nehahra)
diff --git a/host.c b/host.c
index 416d4be..2c3bcd4 100644 (file)
--- a/host.c
+++ b/host.c
@@ -618,7 +618,7 @@ void Host_ServerFrame (void)
 {
        frametimetotal += host_frametime;
        // LordHavoc: cap server at sys_ticrate in listen games
-       if (!isDedicated && ((realtime - lastservertime) < sys_ticrate.value))
+       if (!isDedicated && svs.maxclients > 1 && ((realtime - lastservertime) < sys_ticrate.value))
                return;
 // run the world state
        pr_global_struct->frametime = frametimetotal;
index 48149b1..97372b3 100644 (file)
@@ -1073,6 +1073,7 @@ void Host_Spawn_f (void)
        }
        else
        {
+               eval_t *val;
                // set up the edict
                ent = host_client->edict;
 
@@ -1080,6 +1081,8 @@ void Host_Spawn_f (void)
                ent->v.colormap = NUM_FOR_EDICT(ent);
                ent->v.team = (host_client->colors & 15) + 1;
                ent->v.netname = host_client->name - pr_strings;
+               if (val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel))
+                       val->_float = host_client->pmodel;
 
                // copy spawn parms out of the client_t
 
@@ -1637,38 +1640,6 @@ void Host_Stopdemo_f (void)
        CL_Disconnect ();
 }
 
-/*
-======================
-Host_PModel_f
-LordHavoc: Intended for Nehahra, I personally think this is dumb, but Mindcrime won't listen.
-======================
-*/
-void Host_PModel_f (void)
-{
-       int i;
-       eval_t *val;
-
-       if (Cmd_Argc () == 1)
-       {
-               Con_Printf ("\"pmodel\" is \"%s\"\n", cl_pmodel.string);
-               return;
-       }
-       i = atoi(Cmd_Argv(1));
-
-       if (cmd_source == src_command)
-       {
-               if (cl_pmodel.value == i)
-                       return;
-               Cvar_SetValue ("_cl_pmodel", i);
-               if (cls.state == ca_connected)
-                       Cmd_ForwardToServer ();
-               return;
-       }
-
-       if (val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel))
-               val->_float = i;
-}
-
 //=============================================================================
 
 /*
@@ -1719,7 +1690,6 @@ void Host_InitCommands (void)
        Cmd_AddCommand ("ping", Host_Ping_f);
        Cmd_AddCommand ("load", Host_Loadgame_f);
        Cmd_AddCommand ("save", Host_Savegame_f);
-       Cmd_AddCommand ("pmodel", Host_PModel_f);
 
        Cmd_AddCommand ("startdemos", Host_Startdemos_f);
        Cmd_AddCommand ("demos", Host_Demos_f);
index 4e6635f..9120cdc 100644 (file)
--- a/server.h
+++ b/server.h
@@ -103,6 +103,7 @@ typedef struct client_s
 
 // client known data for deltas        
        int                             old_frags;
+       int                             pmodel;
 } client_t;