small cleanups

This commit is contained in:
Bill Currie 2005-04-26 02:54:14 +00:00
parent f1437732a7
commit 23d728022a
2 changed files with 14 additions and 15 deletions

View file

@ -80,7 +80,7 @@ cvar_t *serverdemo;
int (*dwrite) (QFile * file, const void *buf, int count); int (*dwrite) (QFile * file, const void *buf, int count);
static int header = (int) &((header_t *) 0)->data; #define HEADER ((int) &((header_t *) 0)->data)
entity_state_t demo_entities[UPDATE_MASK + 1][MAX_DEMO_PACKET_ENTITIES]; entity_state_t demo_entities[UPDATE_MASK + 1][MAX_DEMO_PACKET_ENTITIES];
@ -175,7 +175,7 @@ SV_DemoWriteToDisk (int type, int to, float time)
oldd = demo.dbuffer.start; oldd = demo.dbuffer.start;
while (pos < demo.dbuf->bufsize) { while (pos < demo.dbuf->bufsize) {
size = p->size; size = p->size;
pos += header + size; pos += HEADER + size;
// no type means we are writing to disk everything // no type means we are writing to disk everything
if (!type || (p->type == type && p->to == to)) { if (!type || (p->type == type && p->to == to)) {
@ -187,14 +187,14 @@ SV_DemoWriteToDisk (int type, int to, float time)
} }
// data is written so it need to be cleard from demobuf // data is written so it need to be cleard from demobuf
if (demo.dbuf->sz.data != (byte *) p) if (demo.dbuf->sz.data != (byte *) p)
memmove (demo.dbuf->sz.data + size + header, memmove (demo.dbuf->sz.data + size + HEADER,
demo.dbuf->sz.data, (byte *) p - demo.dbuf->sz.data); demo.dbuf->sz.data, (byte *) p - demo.dbuf->sz.data);
demo.dbuf->bufsize -= size + header; demo.dbuf->bufsize -= size + HEADER;
demo.dbuf->sz.data += size + header; demo.dbuf->sz.data += size + HEADER;
pos -= size + header; pos -= size + HEADER;
demo.dbuf->sz.maxsize -= size + header; demo.dbuf->sz.maxsize -= size + HEADER;
demo.dbuffer.start += size + header; demo.dbuffer.start += size + HEADER;
} }
// move along // move along
p = (header_t *) (p->data + size); p = (header_t *) (p->data + size);
@ -413,7 +413,7 @@ DemoSetBuf (byte type, int to)
p = (header_t *) demo.dbuf->sz.data; p = (header_t *) demo.dbuf->sz.data;
while (pos < demo.dbuf->bufsize) { while (pos < demo.dbuf->bufsize) {
pos += header + p->size; pos += HEADER + p->size;
if (type == p->type && to == p->to && !p->full) { if (type == p->type && to == p->to && !p->full) {
demo.dbuf->sz.cursize = pos; demo.dbuf->sz.cursize = pos;
@ -430,9 +430,9 @@ DemoSetBuf (byte type, int to)
p->size = 0; p->size = 0;
p->full = 0; p->full = 0;
demo.dbuf->bufsize += header; demo.dbuf->bufsize += HEADER;
demo.dbuf->sz.cursize = demo.dbuf->bufsize; demo.dbuf->sz.cursize = demo.dbuf->bufsize;
demo.dbuffer.end += header; demo.dbuffer.end += HEADER;
demo.dbuf->h = p; demo.dbuf->h = p;
} }
@ -458,13 +458,13 @@ DemoWrite_Begin (byte type, int to, int size)
qboolean move = false; qboolean move = false;
// will it fit? // will it fit?
while (demo.dbuf->bufsize + size + header > demo.dbuf->sz.maxsize) { while (demo.dbuf->bufsize + size + HEADER > demo.dbuf->sz.maxsize) {
// if we reached the end of buffer move msgbuf to the begining // if we reached the end of buffer move msgbuf to the begining
if (!move && demo.dbuffer.end > demo.dbuffer.start) if (!move && demo.dbuffer.end > demo.dbuffer.start)
move = true; move = true;
SV_DemoWritePackets (1); SV_DemoWritePackets (1);
if (move && demo.dbuffer.start > demo.dbuf->bufsize + header + size) if (move && demo.dbuffer.start > demo.dbuf->bufsize + HEADER + size)
DemoMoveBuf (); DemoMoveBuf ();
} }

View file

@ -358,7 +358,6 @@ SV_Multicast (const vec3_t origin, int to)
if (sv.demorecording) { if (sv.demorecording) {
if (reliable) { if (reliable) {
// DemoWrite_Begin (dem_multiple, cls, sv.multicast.cursize);
DemoWrite_Begin (dem_all, 0, sv.multicast.cursize); DemoWrite_Begin (dem_all, 0, sv.multicast.cursize);
SZ_Write (&demo.dbuf->sz, sv.multicast.data, sv.multicast.cursize); SZ_Write (&demo.dbuf->sz, sv.multicast.data, sv.multicast.cursize);
} else } else
@ -741,7 +740,7 @@ SV_UpdateToReliableMessages (void)
sv.reliable_datagram.cursize); sv.reliable_datagram.cursize);
} }
if (sv.demorecording) if (sv.demorecording)
SZ_Write (&demo.datagram, sv.datagram.data, sv.datagram.cursize); // FIXME: ??? SZ_Write (&demo.datagram, sv.datagram.data, sv.datagram.cursize);
SZ_Clear (&sv.reliable_datagram); SZ_Clear (&sv.reliable_datagram);
SZ_Clear (&sv.datagram); SZ_Clear (&sv.datagram);