packet entities seem to work. players are a bit borked, though. not sure if

it's in the server or the proxy, yet
This commit is contained in:
Bill Currie 2005-05-08 13:24:00 +00:00
parent 4f9c31595d
commit 07cd150677
3 changed files with 20 additions and 14 deletions

View file

@ -94,6 +94,7 @@ typedef struct server_s {
frame_t frames[UPDATE_BACKUP]; frame_t frames[UPDATE_BACKUP];
entity_state_t entities[MAX_SV_ENTITIES]; entity_state_t entities[MAX_SV_ENTITIES];
byte ent_valid[MAX_SV_ENTITIES];
entity_state_t baselines[MAX_SV_ENTITIES]; entity_state_t baselines[MAX_SV_ENTITIES];
player_t players[MAX_SV_PLAYERS]; player_t players[MAX_SV_PLAYERS];
player_t *player_list; // list of players for multicast player_t *player_list; // list of players for multicast

View file

@ -513,7 +513,7 @@ client_parse_message (client_t *cl)
qboolean move_issued = false; qboolean move_issued = false;
seq_hash = cl->netchan.incoming_sequence; seq_hash = cl->netchan.incoming_sequence;
cl->delta_sequence = -1;
while (1) { while (1) {
if (net_message->badread) { if (net_message->badread) {
qtv_printf ("SV_ReadClientMessage: badread\n"); qtv_printf ("SV_ReadClientMessage: badread\n");
@ -533,7 +533,7 @@ client_parse_message (client_t *cl)
case clc_nop: case clc_nop:
break; break;
case clc_delta: case clc_delta:
/*cl->delta_sequence = */MSG_ReadByte (net_message); cl->delta_sequence = MSG_ReadByte (net_message);
break; break;
case clc_move: case clc_move:
checksumIndex = MSG_GetReadCount (net_message); checksumIndex = MSG_GetReadCount (net_message);
@ -981,12 +981,10 @@ write_entities (client_t *client, sizebuf_t *msg)
for (e = MAX_CLIENTS + 1, ent = sv->entities + e; e < MAX_SV_ENTITIES; for (e = MAX_CLIENTS + 1, ent = sv->entities + e; e < MAX_SV_ENTITIES;
e++, ent++) { e++, ent++) {
// if (ent->free) if (!sv->ent_valid[e])
// continue;
// ignore ents without visible models
if (!ent->modelindex)
continue; continue;
if (ent->number && ent->number != e)
qtv_printf ("%d %d\n", e, ent->number);
#if 0 #if 0
if (pvs) { if (pvs) {
// ignore if not touching a PV leaf // ignore if not touching a PV leaf
@ -1002,8 +1000,10 @@ write_entities (client_t *client, sizebuf_t *msg)
// continue; // added to the special update list // continue; // added to the special update list
// add to the packetentities // add to the packetentities
if (pack->num_entities == MAX_PACKET_ENTITIES) if (pack->num_entities == MAX_PACKET_ENTITIES) {
qtv_printf ("mpe overflow\n");
continue; // all full continue; // all full
}
state = &pack->entities[pack->num_entities]; state = &pack->entities[pack->num_entities];
pack->num_entities++; pack->num_entities++;

View file

@ -306,7 +306,7 @@ static void
sv_packetentities (server_t *sv, qmsg_t *msg, int delta) sv_packetentities (server_t *sv, qmsg_t *msg, int delta)
{ {
unsigned short word; unsigned short word;
int newnum, oldnum, from; int newnum, oldnum, from, num;
int newindex, oldindex; int newindex, oldindex;
int newpacket, oldpacket; int newpacket, oldpacket;
int full; int full;
@ -335,6 +335,7 @@ sv_packetentities (server_t *sv, qmsg_t *msg, int delta)
oldp = &dummy; oldp = &dummy;
dummy.num_entities = 0; dummy.num_entities = 0;
full = 1; full = 1;
memset (sv->ent_valid, 0, sizeof (sv->ent_valid));
} }
//qtv_printf ("newp = %-5d oldp = %d\n", newpacket, oldpacket & UPDATE_MASK); //qtv_printf ("newp = %-5d oldp = %d\n", newpacket, oldpacket & UPDATE_MASK);
sv->delta = sv->netchan.incoming_sequence; sv->delta = sv->netchan.incoming_sequence;
@ -357,8 +358,9 @@ sv_packetentities (server_t *sv, qmsg_t *msg, int delta)
return; return;
} }
newp->entities[newindex] = oldp->entities[oldindex]; newp->entities[newindex] = oldp->entities[oldindex];
newnum = newp->entities[newindex].number; num = newp->entities[newindex].number;
sv->entities[newnum] = newp->entities[newindex]; sv->entities[num] = newp->entities[newindex];
sv->ent_valid[num] = 1;
newindex++; newindex++;
oldindex++; oldindex++;
} }
@ -383,7 +385,9 @@ sv_packetentities (server_t *sv, qmsg_t *msg, int delta)
return; return;
} }
newp->entities[newindex] = oldp->entities[oldindex]; newp->entities[newindex] = oldp->entities[oldindex];
sv->entities[newnum] = newp->entities[newindex]; num = newp->entities[newindex].number;
sv->entities[num] = newp->entities[newindex];
sv->ent_valid[num] = 1;
newindex++; newindex++;
oldindex++; oldindex++;
oldnum = 9999; oldnum = 9999;
@ -420,13 +424,14 @@ sv_packetentities (server_t *sv, qmsg_t *msg, int delta)
qtv_printf ("WARNING: delta on full update\n"); qtv_printf ("WARNING: delta on full update\n");
} }
if (word & U_REMOVE) { if (word & U_REMOVE) {
memset (&sv->entities[newnum], 0, sizeof (entity_state_t)); sv->ent_valid[newnum] = 0;
oldindex++; oldindex++;
continue; continue;
} }
newp->entities[newindex] = oldp->entities[oldindex]; newp->entities[newindex] = oldp->entities[oldindex];
sv_parse_delta (msg, word, &sv->entities[newindex]); sv_parse_delta (msg, word, &newp->entities[newindex]);
sv->entities[newnum] = newp->entities[newindex]; sv->entities[newnum] = newp->entities[newindex];
sv->ent_valid[newnum] = 1;
newindex++; newindex++;
oldindex++; oldindex++;
} }