- 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)
This commit is contained in:
Adam Olsen 2001-12-21 18:22:56 +00:00
parent 417bf41353
commit 5c299b0b85
4 changed files with 29 additions and 3 deletions

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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];