Server-side MVD playback is more healthy now.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@830 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
51da6d3abf
commit
6580299f61
6 changed files with 59 additions and 33 deletions
|
@ -89,17 +89,33 @@ int SNDDMA_Init(soundcardinfo_t *sc)
|
|||
|
||||
// open the sound device, confirm capability to mmap, and get size of dma buffer
|
||||
|
||||
Q_strncpyz(sc->name, snddev, sizeof(sc->name));
|
||||
printf("Initing sound device %s\n", snddev);
|
||||
|
||||
sc->audio_fd = open(snddev, O_RDWR);
|
||||
sc->audio_fd = open(snddev, O_RDWR | O_NONBLOCK); //try the primary device
|
||||
if (sc->audio_fd < 0)
|
||||
{
|
||||
perror(snddev);
|
||||
Con_Printf("Could not open %s\n", snddev);
|
||||
SNDDMA_Shutdown(sc);
|
||||
return 0;
|
||||
|
||||
devname = Cvar_Get("snd_devicename2", "", 0, "Sound controls");
|
||||
snddev = devname->string;
|
||||
if (*snddev) //try a secondary if they named one
|
||||
{
|
||||
printf("Initing sound device %s\n", snddev);
|
||||
sc->audio_fd = open(snddev, O_RDWR | O_NONBLOCK);
|
||||
|
||||
if (sc->audio_fd < 0)
|
||||
Con_Printf("Could not open %s\n", snddev);
|
||||
}
|
||||
|
||||
if (sc->audio_fd < 0)
|
||||
{
|
||||
Con_Printf("Running without sound\n");
|
||||
SNDDMA_Shutdown(sc);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Q_strncpyz(sc->name, snddev, sizeof(sc->name));
|
||||
|
||||
rc = ioctl(sc->audio_fd, SNDCTL_DSP_RESET, 0);
|
||||
if (rc < 0)
|
||||
|
@ -151,7 +167,8 @@ int SNDDMA_Init(soundcardinfo_t *sc)
|
|||
}
|
||||
|
||||
s = getenv("QUAKE_SOUND_SPEED");
|
||||
if (s) sc->sn.speed = atoi(s);
|
||||
if (s)
|
||||
sc->sn.speed = atoi(s);
|
||||
else if ((i = COM_CheckParm("-sndspeed")) != 0)
|
||||
sc->sn.speed = atoi(com_argv[i+1]);
|
||||
else
|
||||
|
|
|
@ -1554,7 +1554,7 @@ void NPP_MVDFlush(void)
|
|||
for (j=0 ; j<3 ; j++)
|
||||
if (flags & (DF_ORIGIN << j))
|
||||
{
|
||||
ents->origin[j] = (int)(buffer[i] + (buffer[i+1]<<8))/8.0f;
|
||||
ents->origin[j] = (signed short)(buffer[i] + (buffer[i+1]<<8))/8.0f;
|
||||
i+=2;
|
||||
}
|
||||
VectorSubtract(ents->origin, oldorg, sv.recordedplayer[playernum].velocity);
|
||||
|
@ -1565,11 +1565,11 @@ void NPP_MVDFlush(void)
|
|||
if (flags & (DF_ANGLES << j))
|
||||
{
|
||||
//FIXME: angle truncation here.
|
||||
ents->angles[j] = (int)(buffer[i] + (buffer[i+1]<<8))/256;
|
||||
ents->angles[j] = (char)((int)(buffer[i] + (buffer[i+1]<<8))/256.0f);
|
||||
i+=2;
|
||||
}
|
||||
|
||||
if (flags & (DF_ANGLES << 0)) //stupid quake bug I believe is the correct quote...
|
||||
if (flags & (DF_ANGLES << 0)) //'stupid quake bug' I believe is the correct quote...
|
||||
ents->angles[0] = ents->angles[0]*-1/3.0f; //also scale pitch down as well as invert
|
||||
|
||||
VectorSubtract(ents->angles, oldang, sv.recordedplayer[playernum].avelocity);
|
||||
|
|
|
@ -85,7 +85,7 @@ typedef struct {
|
|||
typedef struct
|
||||
{
|
||||
vec3_t origin;
|
||||
qbyte angles[3];
|
||||
char angles[3];
|
||||
qbyte modelindex;
|
||||
qbyte frame;
|
||||
qbyte colormap;
|
||||
|
@ -94,7 +94,7 @@ typedef struct
|
|||
|
||||
qbyte scale;
|
||||
qbyte trans;
|
||||
qbyte fatness;
|
||||
char fatness;
|
||||
} mvdentity_state_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -1129,22 +1129,6 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
|
|||
|
||||
for (j=0,cl=svs.clients ; j<sv.allocated_client_slots ; j++,cl++)
|
||||
{
|
||||
isbot = !cl->state && cl->name[0];
|
||||
if (!sv.demostatevalid)
|
||||
if (cl->state != cs_spawned) //this includes bots
|
||||
if (!isbot || progstype != PROG_NQ) //unless they're NQ bots...
|
||||
continue;
|
||||
|
||||
ent = cl->edict;
|
||||
if (cl->viewent && ent == clent)
|
||||
{
|
||||
vent = EDICT_NUM(svprogfuncs, cl->viewent);
|
||||
if (!vent)
|
||||
vent = ent;
|
||||
}
|
||||
else
|
||||
vent = ent;
|
||||
|
||||
if (sv.demostatevalid) //this is a demo
|
||||
{
|
||||
// ZOID visibility tracking
|
||||
|
@ -1164,7 +1148,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
|
|||
}
|
||||
}
|
||||
*/
|
||||
if (ent == clent)
|
||||
if (cl->edict == clent && svs.clients[j].spec_track>0)
|
||||
i = svs.clients[j].spec_track-1;
|
||||
else
|
||||
i = j;
|
||||
|
@ -1205,7 +1189,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
|
|||
ang[1] = sv.demostate[i+1].angles[1]*360.0f/256+ (realtime - sv.recordedplayer[i].updatetime)*sv.recordedplayer[i].avelocity[1];
|
||||
ang[2] = sv.demostate[i+1].angles[2]*360.0f/256+ (realtime - sv.recordedplayer[i].updatetime)*sv.recordedplayer[i].avelocity[2];
|
||||
|
||||
VectorMA(sv.demostate[i+1].origin, realtime - sv.recordedplayer[i].updatetime, sv.recordedplayer[i].velocity, org);
|
||||
VectorMA(sv.demostate[i+1].origin, (realtime - sv.recordedplayer[i].updatetime), sv.recordedplayer[i].velocity, org);
|
||||
ang[0] *= -3;
|
||||
|
||||
// ang[0] = ang[1] = ang[2] = 0;
|
||||
|
@ -1237,15 +1221,37 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
|
|||
client_t *s;
|
||||
for (s = cl; s; s = s->controlled, splitnum++)
|
||||
{
|
||||
if (s->edict == ent)
|
||||
if (s->edict == cl->edict)
|
||||
break;
|
||||
}
|
||||
if (!s)
|
||||
continue;
|
||||
}
|
||||
else if (ent != clent)
|
||||
else if (cl->edict != clent)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
isbot = !cl->state && cl->name[0];
|
||||
if (cl->state != cs_spawned) //this includes bots
|
||||
if (!isbot || progstype != PROG_NQ) //unless they're NQ bots...
|
||||
continue;
|
||||
|
||||
ent = cl->edict;
|
||||
if (cl->viewent && ent == clent)
|
||||
{
|
||||
vent = EDICT_NUM(svprogfuncs, cl->viewent);
|
||||
if (!vent)
|
||||
vent = ent;
|
||||
}
|
||||
else
|
||||
vent = ent;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (progstype != PROG_QW)
|
||||
{
|
||||
|
|
|
@ -1659,7 +1659,7 @@ void SV_SendMVDMessage(void)
|
|||
qbyte buf[MAX_DATAGRAM];
|
||||
sizebuf_t msg;
|
||||
edict_t *ent;
|
||||
int stats[MAX_CL_STATS];
|
||||
int stats[MAX_QW_STATS];
|
||||
float min_fps;
|
||||
extern cvar_t sv_demofps;
|
||||
extern cvar_t sv_demoPings;
|
||||
|
@ -1731,7 +1731,7 @@ void SV_SendMVDMessage(void)
|
|||
// stuff the sigil bits into the high bits of items for sbar
|
||||
stats[STAT_ITEMS] = (int)ent->v.items | ((int)pr_global_struct->serverflags << 28);
|
||||
|
||||
for (j=0 ; j<MAX_CL_STATS ; j++)
|
||||
for (j=0 ; j<MAX_QW_STATS ; j++)
|
||||
if (stats[j] != demo.stats[i][j])
|
||||
{
|
||||
demo.stats[i][j] = stats[j];
|
||||
|
|
|
@ -240,7 +240,10 @@ void SV_New_f (void)
|
|||
|
||||
// send server info string
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", svs.info) );
|
||||
if (svs.demostatevalid)
|
||||
MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", sv.demoinfo));
|
||||
else
|
||||
MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", svs.info) );
|
||||
|
||||
// send music
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_cdtrack);
|
||||
|
|
Loading…
Reference in a new issue