]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
added support for arguire's strange protocols that expand
[xonotic/darkplaces.git] / cl_parse.c
index cb933480938d1623911492212703f7cfedd7d5bc..4061b81f15dacd593ffc5886a63fd4c6311bdf47 100644 (file)
@@ -245,7 +245,7 @@ void CL_ParseStartSoundPacket(int largesoundindex)
                        channel &= 7;
                }
 
-               if (largesoundindex || field_mask & SND_LARGESOUND)
+               if (largesoundindex || (field_mask & SND_LARGESOUND) || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3)
                        sound_num = (unsigned short) MSG_ReadShort ();
                else
                        sound_num = MSG_ReadByte ();
@@ -1738,6 +1738,11 @@ void CL_ParseBaseline (entity_t *ent, int large)
                ent->state_baseline.modelindex = (unsigned short) MSG_ReadShort ();
                ent->state_baseline.frame = (unsigned short) MSG_ReadShort ();
        }
+       else if (cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3)
+       {
+               ent->state_baseline.modelindex = (unsigned short) MSG_ReadShort ();
+               ent->state_baseline.frame = MSG_ReadByte ();
+       }
        else
        {
                ent->state_baseline.modelindex = MSG_ReadByte ();
@@ -1770,7 +1775,7 @@ void CL_ParseClientdata (void)
        VectorCopy (cl.mvelocity[0], cl.mvelocity[1]);
        cl.mviewzoom[1] = cl.mviewzoom[0];
 
-       if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5)
+       if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5)
        {
                cl.stats[STAT_VIEWHEIGHT] = DEFAULT_VIEWHEIGHT;
                cl.stats[STAT_ITEMS] = 0;
@@ -1804,7 +1809,7 @@ void CL_ParseClientdata (void)
        {
                if (bits & (SU_PUNCH1<<i) )
                {
-                       if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE)
+                       if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3)
                                cl.mpunchangle[0][i] = MSG_ReadChar();
                        else
                                cl.mpunchangle[0][i] = MSG_ReadAngle16i();
@@ -1818,7 +1823,7 @@ void CL_ParseClientdata (void)
                }
                if (bits & (SU_VELOCITY1<<i) )
                {
-                       if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4)
+                       if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4)
                                cl.mvelocity[0][i] = MSG_ReadChar()*16;
                        else
                                cl.mvelocity[0][i] = MSG_ReadCoord32f();
@@ -1826,7 +1831,7 @@ void CL_ParseClientdata (void)
        }
 
        // LordHavoc: hipnotic demos don't have this bit set but should
-       if (bits & SU_ITEMS || cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5)
+       if (bits & SU_ITEMS || cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5)
                cl.stats[STAT_ITEMS] = MSG_ReadLong ();
 
        cl.onground = (bits & SU_ONGROUND) != 0;
@@ -1845,11 +1850,14 @@ void CL_ParseClientdata (void)
                cl.stats[STAT_CELLS] = MSG_ReadShort();
                cl.stats[STAT_ACTIVEWEAPON] = (unsigned short) MSG_ReadShort ();
        }
-       else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4)
+       else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4)
        {
                cl.stats[STAT_WEAPONFRAME] = (bits & SU_WEAPONFRAME) ? MSG_ReadByte() : 0;
                cl.stats[STAT_ARMOR] = (bits & SU_ARMOR) ? MSG_ReadByte() : 0;
-               cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? MSG_ReadByte() : 0;
+               if (cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3)
+                       cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? (unsigned short)MSG_ReadShort() : 0;
+               else
+                       cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? MSG_ReadByte() : 0;
                cl.stats[STAT_HEALTH] = MSG_ReadShort();
                cl.stats[STAT_AMMO] = MSG_ReadByte();
                cl.stats[STAT_SHELLS] = MSG_ReadByte();
@@ -1925,7 +1933,7 @@ void CL_ParseStaticSound (int large)
        int                     sound_num, vol, atten;
 
        MSG_ReadVector(org, cls.protocol);
-       if (large)
+       if (large || cls.protocol == PROTOCOL_NEHAHRABJP2)
                sound_num = (unsigned short) MSG_ReadShort ();
        else
                sound_num = MSG_ReadByte ();
@@ -2888,7 +2896,7 @@ static void CL_NetworkTimeReceived(double newtime)
        if (cls.timedemo || (cl.islocalgame && !sv_fixedframeratesingleplayer.integer) || cl.mtime[1] == cl.mtime[0] || cls.signon < SIGNONS)
                cl.time = cl.mtime[1] = newtime;
        else if (cls.demoplayback)
-       {       
+       {
                // when time falls behind during demo playback it means the cl.mtime[1] was altered
                // due to a large time gap, so treat it as an instant change in time
                // (this can also happen during heavy packet loss in the demo)