]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
eliminated qbyte type, now uses unsigned char throughout the engine for this purpose
[xonotic/darkplaces.git] / cl_parse.c
index 245e094f0c62c4a459d5c3cd6340a84788fc492a..e2769baa915c3c9a421ed7bf35f4086754f413b8 100644 (file)
@@ -29,7 +29,7 @@ char *svc_strings[128] =
        "svc_nop",
        "svc_disconnect",
        "svc_updatestat",
-       "svc_version",          // [long] server version
+       "svc_version",          // [int] server version
        "svc_setview",          // [short] entity number
        "svc_sound",                    // <see code>
        "svc_time",                     // [float] server time
@@ -38,7 +38,7 @@ char *svc_strings[128] =
                                                // the string should be \n terminated
        "svc_setangle",         // [vec3] set the view angle to this absolute value
 
-       "svc_serverinfo",               // [long] version
+       "svc_serverinfo",               // [int] version
                                                // [string] signon string
                                                // [string]..[0]model cache [string]...[0]sounds cache
                                                // [string]..[0]item cache
@@ -168,7 +168,7 @@ so the server doesn't disconnect.
 ==================
 */
 
-static qbyte olddata[NET_MAXMESSAGE];
+static unsigned char olddata[NET_MAXMESSAGE];
 void CL_KeepaliveMessage (void)
 {
        float time;
@@ -197,7 +197,7 @@ void CL_KeepaliveMessage (void)
        if (cls.netcon && NetConn_CanSendMessage(cls.netcon) && (time = Sys_DoubleTime()) - lastmsg >= 5)
        {
                sizebuf_t       msg;
-               qbyte           buf[4];
+               unsigned char           buf[4];
                lastmsg = time;
                // write out a nop
                // LordHavoc: must use unreliable because reliable could kill the sigon message!
@@ -280,29 +280,29 @@ Con_DPrintf("CL_SignonReply: %i\n", cls.signon);
 
        case 2:
                MSG_WriteByte (&cls.message, clc_stringcmd);
-               MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
+               MSG_WriteString (&cls.message, va("name \"%s\"", cl_name.string));
 
                MSG_WriteByte (&cls.message, clc_stringcmd);
-               MSG_WriteString (&cls.message, va("color %i %i\n", cl_color.integer >> 4, cl_color.integer & 15));
+               MSG_WriteString (&cls.message, va("color %i %i", cl_color.integer >> 4, cl_color.integer & 15));
 
                if (cl_pmodel.integer)
                {
                        MSG_WriteByte (&cls.message, clc_stringcmd);
-                       MSG_WriteString (&cls.message, va("pmodel %i\n", cl_pmodel.integer));
+                       MSG_WriteString (&cls.message, va("pmodel %i", cl_pmodel.integer));
                }
                if (*cl_playermodel.string)
                {
                        MSG_WriteByte (&cls.message, clc_stringcmd);
-                       MSG_WriteString (&cls.message, va("playermodel %s\n", cl_playermodel.string));
+                       MSG_WriteString (&cls.message, va("playermodel %s", cl_playermodel.string));
                }
                if (*cl_playerskin.string)
                {
                        MSG_WriteByte (&cls.message, clc_stringcmd);
-                       MSG_WriteString (&cls.message, va("playerskin %s\n", cl_playerskin.string));
+                       MSG_WriteString (&cls.message, va("playerskin %s", cl_playerskin.string));
                }
 
                MSG_WriteByte (&cls.message, clc_stringcmd);
-               MSG_WriteString (&cls.message, va("rate %i\n", cl_rate.integer));
+               MSG_WriteString (&cls.message, va("rate %i", cl_rate.integer));
 
                MSG_WriteByte (&cls.message, clc_stringcmd);
                MSG_WriteString (&cls.message, "spawn");
@@ -366,7 +366,7 @@ void CL_ParseServerInfo (void)
                Host_Error("Bad maxclients (%u) from server\n", cl.maxclients);
                return;
        }
-       cl.scores = Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
+       cl.scores = (scoreboard_t *)Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
 
 // parse gametype
        cl.gametype = MSG_ReadByte ();
@@ -426,8 +426,8 @@ void CL_ParseServerInfo (void)
        // precache any models used by the client (this also marks them used)
        cl.model_bolt = Mod_ForName("progs/bolt.mdl", false, false, false);
        cl.model_bolt2 = Mod_ForName("progs/bolt2.mdl", false, false, false);
-       cl.model_bolt3 = Mod_ForName("progs/bolt3.mdl", true, false, false);
-       cl.model_beam = Mod_ForName("progs/beam.mdl", true, false, false);
+       cl.model_bolt3 = Mod_ForName("progs/bolt3.mdl", false, false, false);
+       cl.model_beam = Mod_ForName("progs/beam.mdl", false, false, false);
        Mod_PurgeUnused();
 
        // do the same for sounds
@@ -448,14 +448,14 @@ void CL_ParseServerInfo (void)
        // world model
        CL_KeepaliveMessage ();
        cl.model_precache[1] = Mod_ForName(parse_model_precache[1], false, false, true);
-       if (cl.model_precache[1] == NULL)
+       if (cl.model_precache[1]->Draw == NULL)
                Con_Printf("Map %s not found\n", parse_model_precache[1]);
 
        // normal models
        for (i=2 ; i<nummodels ; i++)
        {
                CL_KeepaliveMessage();
-               if ((cl.model_precache[i] = Mod_ForName(parse_model_precache[i], false, false, false)) == NULL)
+               if ((cl.model_precache[i] = Mod_ForName(parse_model_precache[i], false, false, false))->Draw == NULL)
                        Con_Printf("Model %s not found\n", parse_model_precache[i]);
        }
 
@@ -475,6 +475,7 @@ void CL_ParseServerInfo (void)
        ent->render.model = cl.worldmodel = cl.model_precache[1];
        ent->render.scale = 1; // some of the renderer still relies on scale
        ent->render.alpha = 1;
+       ent->render.colormap = -1; // no special coloring
        ent->render.flags = RENDER_SHADOW | RENDER_LIGHT;
        Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, 0, 0, 0, 0, 0, 0, 1);
        Matrix4x4_Invert_Simple(&ent->render.inversematrix, &ent->render.matrix);
@@ -510,7 +511,6 @@ void CL_ValidateState(entity_state_t *s)
        }
 
        model = cl.model_precache[s->modelindex];
-       Mod_CheckLoaded(model);
        if (model && model->type && s->frame >= model->numframes)
        {
                Con_DPrintf("CL_ValidateState: no such frame %i in \"%s\" (which has %i frames)\n", s->frame, model->name, model->numframes);
@@ -574,7 +574,7 @@ void CL_MoveLerpEntityStates(entity_t *ent)
                // not a monster
                ent->persistent.lerpstarttime = ent->state_previous.time;
                // no lerp if it's singleplayer
-               if (cl.islocalgame)
+               if (cl.islocalgame && !sv_fixedframeratesingleplayer.integer)
                        ent->persistent.lerpdeltatime = 0;
                else
                        ent->persistent.lerpdeltatime = bound(0, ent->state_current.time - ent->state_previous.time, 0.1);
@@ -862,7 +862,7 @@ void CL_ParseBeam (model_t *m, int lightning)
        // override any beam with the same entity
        for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
        {
-               if (b->entity == ent)
+               if (b->entity == ent && ent)
                {
                        //b->entity = ent;
                        b->lightning = lightning;
@@ -903,7 +903,7 @@ void CL_ParseTempEntity(void)
        int rnd;
        int colorStart, colorLength, count;
        float velspeed, radius;
-       qbyte *tempcolor;
+       unsigned char *tempcolor;
        matrix4x4_t tempmatrix;
 
        type = MSG_ReadByte();
@@ -1252,7 +1252,7 @@ void CL_ParseTempEntity(void)
                colorStart = MSG_ReadByte();
                colorLength = MSG_ReadByte();
                CL_ParticleExplosion2(pos, colorStart, colorLength);
-               tempcolor = (qbyte *)&palette_complete[(rand()%colorLength) + colorStart];
+               tempcolor = (unsigned char *)&palette_complete[(rand()%colorLength) + colorStart];
                color[0] = tempcolor[0] * (2.0f / 255.0f);
                color[1] = tempcolor[1] * (2.0f / 255.0f);
                color[2] = tempcolor[2] * (2.0f / 255.0f);
@@ -1304,7 +1304,7 @@ void CL_ParseTempEntity(void)
 
 #define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf("%3i:%s\n", msg_readcount-1, x);
 
-static qbyte cgamenetbuffer[65536];
+static unsigned char cgamenetbuffer[65536];
 
 /*
 =====================
@@ -1317,7 +1317,7 @@ void CL_ParseServerMessage(void)
        int                     cmd;
        int                     i;
        protocolversion_t protocol;
-       qbyte           cmdlog[32];
+       unsigned char           cmdlog[32];
        char            *cmdlogname[32], *temp;
        int                     cmdindex, cmdcount = 0;
        qboolean        sendmove = false;
@@ -1489,7 +1489,7 @@ void CL_ParseServerMessage(void)
                                Host_Error ("svc_lightstyle >= MAX_LIGHTSTYLES");
                        strlcpy (cl_lightstyle[i].map,  MSG_ReadString(), sizeof (cl_lightstyle[i].map));
                        cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
-                       cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
+                       cl_lightstyle[i].length = (int)strlen(cl_lightstyle[i].map);
                        break;
 
                case svc_sound:
@@ -1651,9 +1651,9 @@ void CL_ParseServerMessage(void)
                        cl.cdtrack = MSG_ReadByte ();
                        cl.looptrack = MSG_ReadByte ();
                        if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
-                               CDAudio_Play ((qbyte)cls.forcetrack, true);
+                               CDAudio_Play ((unsigned char)cls.forcetrack, true);
                        else
-                               CDAudio_Play ((qbyte)cl.cdtrack, true);
+                               CDAudio_Play ((unsigned char)cl.cdtrack, true);
                        break;
 
                case svc_intermission: