From 5c299b0b856cb715d15154099944d35aea0853ba Mon Sep 17 00:00:00 2001 From: Adam Olsen Date: Fri, 21 Dec 2001 18:22:56 +0000 Subject: [PATCH] - fix a missing space in net_packetlog's output for svc_qwsound - make entity remapping for baseline entities permanent. (atleast for 0 through 255. don't want to make ALL mappings permanent) --- libs/net/net_packetlog.c | 2 +- qw/include/server.h | 1 + qw/source/sv_entmap.c | 24 ++++++++++++++++++++++-- qw/source/sv_init.c | 5 +++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/libs/net/net_packetlog.c b/libs/net/net_packetlog.c index ce22fee1e..59e46b15f 100644 --- a/libs/net/net_packetlog.c +++ b/libs/net/net_packetlog.c @@ -396,7 +396,7 @@ Parse_Server_Packet () if (i & SND_VOLUME) Net_LogPrintf ("Volume %d ", MSG_ReadByte (&packet)); if (i & SND_ATTENUATION) - Net_LogPrintf ("Ann: %f", + Net_LogPrintf ("Ann: %f ", (float) MSG_ReadByte (&packet) / 64.0); ii = MSG_ReadByte (&packet); diff --git a/qw/include/server.h b/qw/include/server.h index 851e3309d..670a8d85f 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -560,6 +560,7 @@ void SV_EntMap_Delete (entmap_t *entmap); void SV_EntMap_Add (entmap_t *entmap, int entnum, int netnum); void SV_EntMap_Touch (entmap_t *entmap, int netnum); void SV_EntMap_Clean (entmap_t *entmap, float window); +void SV_EntMap_MakePermanent (entmap_t *entmap, int netnum); // // sv_ents.c diff --git a/qw/source/sv_entmap.c b/qw/source/sv_entmap.c index 18e617645..e0e46834d 100644 --- a/qw/source/sv_entmap.c +++ b/qw/source/sv_entmap.c @@ -55,7 +55,7 @@ SV_EntMap_Get (entmap_t *entmap, int entnum) i = entmap->internal[entnum]; if (i != ENTMAP_INVALID) { // check if already mapped - entmap->network[i].usedtime = realtime; + SV_EntMap_Touch (entmap, i); return i; } @@ -190,7 +190,9 @@ SV_EntMap_Touch (entmap_t *entmap, int netnum) if (entmap->network[netnum].internal == ENTMAP_INVALID) Sys_Error ("SV_EntMap_Touch: netnum not mapped: %d", netnum); - entmap->network[netnum].usedtime = realtime; + // update the usedtime, if it's not a permanent mapping + if (entmap->network[netnum].usedtime) + entmap->network[netnum].usedtime = realtime; } /* @@ -207,9 +209,27 @@ SV_EntMap_Clean (entmap_t *entmap, float window) for (i = MAX_CLIENTS + 1; i < sizeof (entmap->network) / sizeof (entmap_item_t); i++) if (entmap->network[i].internal != ENTMAP_INVALID && + entmap->network[i].usedtime && entmap->network[i].usedtime + window < realtime) { entmap->internal[entmap->network[i].internal] = ENTMAP_INVALID; entmap->network[i].internal = ENTMAP_INVALID; entmap->network[i].usedtime = 0; } } + +/* + SV_EntMap_MakePermanent + + Makes the mapping for the given netnum permanent +*/ +void +SV_EntMap_MakePermanent (entmap_t *entmap, int netnum) +{ + if (netnum < 0 || netnum >= MAX_NET_EDICTS) + Sys_Error ("SV_EntMap_Touch: invalid netnum: %d", netnum); + + if (entmap->network[netnum].internal == ENTMAP_INVALID) + Sys_Error ("SV_EntMap_Touch: netnum not mapped: %d", netnum); + + entmap->network[netnum].usedtime = 0; +} diff --git a/qw/source/sv_init.c b/qw/source/sv_init.c index b32a4733a..733f97caf 100644 --- a/qw/source/sv_init.c +++ b/qw/source/sv_init.c @@ -138,6 +138,11 @@ SV_CreateBaseline (void) if (netnum == ENTMAP_INVALID) continue; + // make the mapping permanent (but don't make them ALL + // permanent if there's alot) + if (entnum < MAX_NET_EDICTS / 2) + SV_EntMap_MakePermanent (&entmap_baseline, netnum); + // create entity baseline baseline = &baselines[netnum];