0,//unsigned char tagindex;
{32, 32, 32},//unsigned char colormod[3];
{32, 32, 32},//unsigned char glowmod[3];
- // padding to a multiple of 8 bytes (to align the double time)
- {0,0}//unsigned char unused[2]; // !
};
// LordHavoc: I own protocol ranges 96, 97, 3500-3599
struct protocolversioninfo_s
{
int number;
+ protocolversion_t version;
const char *name;
}
protocolversioninfo[] =
{
- {0, "UNKNOWN"},
- {3504, "DP7"},
- {3503, "DP6"},
- {3502, "DP5"},
- {3501, "DP4"},
- {3500, "DP3"},
- {97, "DP2"},
- {96, "DP1"},
- {15, "QUAKEDP"},
- {250, "NEHAHRAMOVIE"},
- {15, "QUAKE"},
- {28, "QW"},
- {10000, "NEHAHRABJP"},
- {10001, "NEHAHRABJP2"},
- {10002, "NEHAHRABJP3"},
- {0, NULL}
+ { 3504, PROTOCOL_DARKPLACES7 , "DP7"},
+ { 3503, PROTOCOL_DARKPLACES6 , "DP6"},
+ { 3502, PROTOCOL_DARKPLACES5 , "DP5"},
+ { 3501, PROTOCOL_DARKPLACES4 , "DP4"},
+ { 3500, PROTOCOL_DARKPLACES3 , "DP3"},
+ { 97, PROTOCOL_DARKPLACES2 , "DP2"},
+ { 96, PROTOCOL_DARKPLACES1 , "DP1"},
+ { 15, PROTOCOL_QUAKEDP , "QUAKEDP"},
+ { 15, PROTOCOL_QUAKE , "QUAKE"},
+ { 28, PROTOCOL_QUAKEWORLD , "QW"},
+ { 250, PROTOCOL_NEHAHRAMOVIE, "NEHAHRAMOVIE"},
+ {10000, PROTOCOL_NEHAHRABJP , "NEHAHRABJP"},
+ {10001, PROTOCOL_NEHAHRABJP2 , "NEHAHRABJP2"},
+ {10002, PROTOCOL_NEHAHRABJP3 , "NEHAHRABJP3"},
+ { 0, PROTOCOL_UNKNOWN , NULL}
};
protocolversion_t Protocol_EnumForName(const char *s)
{
int i;
- for (i = 1;protocolversioninfo[i].name;i++)
+ for (i = 0;protocolversioninfo[i].name;i++)
if (!strcasecmp(s, protocolversioninfo[i].name))
- return (protocolversion_t)i;
+ return protocolversioninfo[i].version;
return PROTOCOL_UNKNOWN;
}
const char *Protocol_NameForEnum(protocolversion_t p)
{
- return protocolversioninfo[p].name;
+ int i;
+ for (i = 0;protocolversioninfo[i].name;i++)
+ if (protocolversioninfo[i].version == p)
+ return protocolversioninfo[i].name;
+ return "UNKNOWN";
}
protocolversion_t Protocol_EnumForNumber(int n)
{
int i;
- for (i = 1;protocolversioninfo[i].name;i++)
+ for (i = 0;protocolversioninfo[i].name;i++)
if (protocolversioninfo[i].number == n)
- return (protocolversion_t)i;
+ return protocolversioninfo[i].version;
return PROTOCOL_UNKNOWN;
}
int Protocol_NumberForEnum(protocolversion_t p)
{
- return protocolversioninfo[p].number;
+ int i;
+ for (i = 0;protocolversioninfo[i].name;i++)
+ if (protocolversioninfo[i].version == p)
+ return protocolversioninfo[i].number;
+ return 0;
}
void Protocol_Names(char *buffer, size_t buffersize)
if (buffersize < 1)
return;
buffer[0] = 0;
- for (i = 1;protocolversioninfo[i].name;i++)
+ for (i = 0;protocolversioninfo[i].name;i++)
{
if (i > 1)
strlcat(buffer, " ", buffersize);
void EntityFrameCSQC_LostFrame(client_t *client, int framenum)
{
// marks a frame as lost
- int i, j, n;
+ int i, j;
qboolean valid;
int ringfirst, ringlast;
static int recoversendflags[MAX_EDICTS];
csqcentityframedb_t *d;
- n = client->csqcnumedicts;
+ if(client->csqcentityframe_lastreset < 0)
+ return;
+ if(framenum < client->csqcentityframe_lastreset)
+ return; // no action required, as we resent that data anyway
// is our frame out of history?
ringfirst = client->csqcentityframehistory_next; // oldest entry
Con_DPrintf("Lost frame = %d\n", framenum);
Con_DPrintf("Entity DB = %d to %d\n", client->csqcentityframehistory[ringfirst].framenum, client->csqcentityframehistory[ringlast].framenum);
EntityFrameCSQC_LostAllFrames(client);
+ client->csqcentityframe_lastreset = -1;
}
return;
}
int dbframe = EntityFrameCSQC_AllocFrame(client, framenum);
csqcentityframedb_t *db = &client->csqcentityframehistory[dbframe];
+ if(client->csqcentityframe_lastreset < 0)
+ client->csqcentityframe_lastreset = framenum;
+
maxsize -= 24; // always fit in an empty svc_entities message (for packet loss detection!)
// if this server progs is not CSQC-aware, return early
static int EntityState5_Priority(entityframe5_database_t *d, int stateindex)
{
int limit, priority;
- entity_state_t *s;
+ entity_state_t *s = NULL; // hush compiler warning by initializing this
// if it is the player, update urgently
if (stateindex == d->viewentnum)
return ENTITYFRAME5_PRIORITYLEVELS - 1;
if (bits & QW_CM_UP)
MSG_ReadShort(); // cmd->upmove
if (bits & QW_CM_BUTTONS)
- MSG_ReadByte(); // cmd->buttons
+ (void) MSG_ReadByte(); // cmd->buttons
if (bits & QW_CM_IMPULSE)
- MSG_ReadByte(); // cmd->impulse
- MSG_ReadByte(); // cmd->msec
+ (void) MSG_ReadByte(); // cmd->impulse
+ (void) MSG_ReadByte(); // cmd->msec
}
if (playerflags & QW_PF_VELOCITY1)
velocity[0] = MSG_ReadShort();