Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Clear demo queue when appropriate w/ demo recording
Browse files Browse the repository at this point in the history
Fix alpha parsing of static entities
Don't output vid frames while console is down, and make console open/close instantly
  • Loading branch information
hobgoblin committed Aug 12, 2012
1 parent 9a6f24d commit 0ca0db5
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 70 deletions.
13 changes: 12 additions & 1 deletion cl_demo.c
Expand Up @@ -352,6 +352,14 @@ void CL_Stop_f (void)
Con_Printf ("Completed demo\n");
}

void CL_Clear_Demos_Queue (void) //qbism - from FQ Mark V
{
int i;
for (i = 0;i < MAX_DEMOS; i ++) // Clear demo loop queue
cls.demos[i][0] = 0;
cls.demonum = -1; // Set next demo to none
}


/*
====================
Expand Down Expand Up @@ -427,7 +435,7 @@ void CL_Record_f (void)
track = -1;

sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));

CL_Clear_Demos_Queue (); //qbism - from FQ Mark V timedemo is a very intentional action
//
// start the map up
//
Expand Down Expand Up @@ -624,7 +632,10 @@ void CL_TimeDemo_f (void)
Con_Printf ("timedemo <demoname> : gets demo speeds\n");
return;
}
if (key_dest != key_game) //qbism - close console from FQ Mark V
key_dest = key_game;

CL_Clear_Demos_Queue (); //qbism - from FQ Mark V - timedemo is a very intentional action
CL_PlayDemo_f ();

// cls.td_starttime will be grabbed at the second frame of the demo, so
Expand Down
1 change: 1 addition & 0 deletions cl_main.c
Expand Up @@ -171,6 +171,7 @@ void CL_Disconnect (void)

void CL_Disconnect_f (void)
{
CL_Clear_Demos_Queue (); //qbism - from FQ Mark V - timedemo is a very intentional action
CL_Disconnect ();
if (sv.active)
Host_ShutdownServer (false);
Expand Down
11 changes: 8 additions & 3 deletions cl_parse.c
Expand Up @@ -842,7 +842,12 @@ void CL_ParseBaseline (entity_t *ent)
ent->baseline.modelindex = MSG_ReadShort ();
ent->baseline.alpha = MSG_ReadByte(); //qbism: johnfitz -- PROTOCOL_FITZQUAKE
}
else ent->baseline.modelindex = MSG_ReadByte ();
else
{
ent->baseline.modelindex = MSG_ReadByte ();
ent->baseline.alpha = ENTALPHA_DEFAULT;
}


ent->baseline.frame = MSG_ReadByte ();
ent->baseline.colormap = MSG_ReadByte();
Expand Down Expand Up @@ -1084,6 +1089,8 @@ void CL_ParseStatic (void)
if (current_protocol == PROTOCOL_QBS8)
{
int bits;

ent->alpha = ent->baseline.alpha; //qbism: finally figured this out.
bits = MSG_ReadLong("CL_ParseStatic");

if (bits & U_SCALE)
Expand All @@ -1110,7 +1117,6 @@ void CL_ParseStatic (void)
else
{
ent->glow_size = 0;
ent->alpha = ENTALPHA_DEFAULT;
ent->scale2 = 1.0f;
ent->scalev[0] = ent->scalev[1] = ent->scalev[2] = 1.0f;
}
Expand Down Expand Up @@ -1143,7 +1149,6 @@ void CL_ParseStaticSound (void)
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}


#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);

/*
Expand Down
5 changes: 3 additions & 2 deletions host_cmd.c
Expand Up @@ -336,7 +336,7 @@ void Host_Map_f (void)

if (cmd_source != src_command)
return;
cls.demonum = -1; // stop demo loop in case this fails
CL_Clear_Demos_Queue (); //qbism - from FQ Mark V - timedemo is a very intentional action

CL_Disconnect ();
Host_ShutdownServer(false);
Expand Down Expand Up @@ -2093,7 +2093,8 @@ void Host_Stopdemo_f (void)
return;
if (!cls.demoplayback)
return;
CL_StopPlayback ();
CL_StopPlayback ();
CL_Clear_Demos_Queue ();
CL_Disconnect ();
}

Expand Down
109 changes: 54 additions & 55 deletions pr_cmds.c
Expand Up @@ -702,17 +702,17 @@ void PF_ambientsound (void)
}
if (current_protocol == PROTOCOL_QBS8)
{
if (soundnum >MAX_SOUNDS)
if (soundnum >MAX_SOUNDS)
{
Con_Printf ("ambient sound: soundnum > MAX_SOUNDS.\n");
return;
}
}
else if (soundnum >256)
{
Con_Printf ("ambient sound: soundnum >256.\n");
return;
}
{
Con_Printf ("ambient sound: soundnum >256.\n");
return;
}


// add an svc_spawnambient command to the level signon packet
Expand Down Expand Up @@ -775,23 +775,23 @@ void PF_sound (void)
//qbism - plays sound to an individual client... I hear voices...
void PF_localsound (void)
{
char *sample;
char volume;
client_t *client;
int entnum;
char *sample;
char volume;
client_t *client;
int entnum;

entnum = G_EDICTNUM(OFS_PARM0);
if (entnum < 1 || entnum > svs.maxclients)
{
Con_Printf ("tried to send local sound to a non-client\n");
return;
}
entnum = G_EDICTNUM(OFS_PARM0);
if (entnum < 1 || entnum > svs.maxclients)
{
Con_Printf ("tried to send local sound to a non-client\n");
return;
}

client = &svs.clients[entnum-1];
sample = G_STRING(OFS_PARM1);
volume = (char)(G_FLOAT(OFS_PARM2) * 255);
client = &svs.clients[entnum-1];
sample = G_STRING(OFS_PARM1);
volume = (char)(G_FLOAT(OFS_PARM2) * 255);

SV_LocalSound (client, sample, volume);
SV_LocalSound (client, sample, volume);
}

/*
Expand Down Expand Up @@ -1800,20 +1800,25 @@ void PF_makestatic (void)
{
edict_t *ent;
int i;
float scale=1;
vec3_t scalev= {0,0,0};
float glow_size=0;
int bits=0;
eval_t *val;

ent = G_EDICT(OFS_PARM0);

//qbism: johnfitz -- don't send invisible static entities
if (ent->alpha == ENTALPHA_ZERO) {
ED_Free (ent);
return;
}
//johnfitz

MSG_WriteByte (&sv.signon,svc_spawnstatic);

if (current_protocol == PROTOCOL_QBS8)
{
if (val = GetEdictFieldValue(ent, "alpha"))
{
ent->alpha = ENTALPHA_ENCODE(val->_float); //qbism ent->alpha
//qbism: fitzquake don't send invisible entities unless they have effects
if (ent->alpha == ENTALPHA_ZERO && !ent->v.effects)
return;
}
MSG_WriteShort (&sv.signon, SV_ModelIndex(pr_strings + ent->v.model));
MSG_WriteByte (&sv.signon, ent->alpha); //qbism
}
Expand All @@ -1831,17 +1836,11 @@ void PF_makestatic (void)
// Manoel Kasimier - QC Alpha Scale Glow - begin
if (current_protocol == PROTOCOL_QBS8)
{
float scale=1;
vec3_t scalev= {0,0,0};
float glow_size=0;
int bits=0;
eval_t *val;

if ((val = GetEdictFieldValue(ent, "scale")))
{
scale = val->_float;
bits |= U_SCALE;
}
if ((val = GetEdictFieldValue(ent, "scale")))
{
scale = val->_float;
bits |= U_SCALE;
}
if ((val = GetEdictFieldValue(ent, "scalev")))
{
for (i=0 ; i<3 ; i++)
Expand Down Expand Up @@ -2229,27 +2228,27 @@ float fopen (string,float)
*/
void PF_fopen (void) //qbism - updated from mh FRIK_FILE tute
{
char *p = G_STRING(OFS_PARM0);
int fmode = G_FLOAT (OFS_PARM1);
int h = 0;
char *p = G_STRING(OFS_PARM0);
int fmode = G_FLOAT (OFS_PARM1);
int h = 0;

switch (fmode)
{
case 0: // read
Sys_FileOpenRead (va("%s/%s",com_gamedir, p), &h);
break;
switch (fmode)
{
case 0: // read
Sys_FileOpenRead (va("%s/%s",com_gamedir, p), &h);
break;

// case 1: // append -- sane version
// h = Sys_FileOpenAppend (va("%s/%s", com_gamedir, p));
// break;
// case 1: // append -- sane version
// h = Sys_FileOpenAppend (va("%s/%s", com_gamedir, p));
// break;

default: // write
h = Sys_FileOpenWrite (va("%s/%s", com_gamedir, p));
break;
}
default: // write
h = Sys_FileOpenWrite (va("%s/%s", com_gamedir, p));
break;
}

// always common now
G_FLOAT (OFS_RETURN) = (float) h;
// always common now
G_FLOAT (OFS_RETURN) = (float) h;
}


Expand Down Expand Up @@ -2723,7 +2722,7 @@ ebfs_builtin_t pr_ebfs_builtins[] =
{ 47, "nextent", PF_nextent },
{ 48, "particle", PF_particle },
{ 49, "ChangeYaw", PF_changeyaw },
{ 50, "localsound", PF_localsound }, //qbism - plays an S_LocalSound
{ 50, "localsound", PF_localsound }, //qbism - plays an S_LocalSound
{ 51, "vectoangles", PF_vectoangles },

{ 52, "WriteByte", PF_WriteByte },
Expand Down
32 changes: 24 additions & 8 deletions s_win32/movie.c
Expand Up @@ -45,19 +45,24 @@ cvar_t capture_fps = {"capture_fps", "30.0", true};
//qbism - removed, broken.... cvar_t capture_console = {"capture_console", "1", true};
cvar_t capture_hack = {"capture_hack", "0", true};
cvar_t capture_mp3 = {"capture_mp3", "0", true};
cvar_t capture_mp3_kbps = {"capture_mp3_kbps", "128", true};
cvar_t capture_mp3_kbps = {"capture_mp3_kbps", "192", true};

static qboolean movie_is_capturing = false;
qboolean avi_loaded, acm_loaded;

qboolean Movie_IsActive (void)
{
// don't output whilst 'loading' is displayed
if (scr_drawloading)
return false;
// don't output whilst console is down or 'loading' is displayed
if ((/*!capture_console.value && */ scr_con_current > 0) || scr_drawloading)
return false;

//qbism - from FQ Mark V - Never capture the console if capturedemo is running
//qbism - ...but might want to capture console, such as tutorial vid.
//if (cls.capturedemo && scr_con_current > 0)
// return false;

// otherwise output if a file is open to write to
return movie_is_capturing;
// otherwise output if a file is open to write to
return movie_is_capturing;
}

void Movie_Start_f (void)
Expand Down Expand Up @@ -129,15 +134,25 @@ void Movie_Stop_f (void)
Con_Printf ("Stopped capturing\n");
}

void Movie_CaptureDemo_f (void)
void Movie_CaptureDemo_f (void) //qbism - with additional enhancement from FQ Mark V
{
if (Cmd_Argc() != 2)
{
Con_Printf ("Usage: capturedemo <demoname>\n");
Con_Printf ("Usage: capturedemo <demoname>\nstopdemo or capture_stop will end video capture\n");
return;
}

if (movie_is_capturing)
{
Con_Printf ("Can't capture demo, video is capturing\n");
return;
}

Con_Printf ("Capturing %s.dem\n", Cmd_Argv(1));
if (key_dest != key_game)
key_dest = key_game;

CL_Clear_Demos_Queue ();

CL_PlayDemo_f ();
if (!cls.demoplayback)
Expand All @@ -148,6 +163,7 @@ void Movie_CaptureDemo_f (void)

if (!movie_is_capturing)
Movie_StopPlayback ();
Host_Stopdemo_f ();
}

void Movie_Init (void)
Expand Down
2 changes: 2 additions & 0 deletions screen.c
Expand Up @@ -531,6 +531,8 @@ void SCR_SetUpToDrawConsole (void)
timescale = (host_timescale.value > 0) ? host_timescale.value : 1; //qbism - DEMO_REWIND by Baker - johnfitz -- timescale

conspeed = scr_conspeed.value * (vid.height / 200.0f) * host_frametime;
if (cls.timedemo || cls.capturedemo)
frame_timescale = .00001; // Make it open or close instantly in timedemo

if (scr_conlines < scr_con_current)
{
Expand Down
2 changes: 1 addition & 1 deletion version.h
@@ -1 +1 @@
#define BUILDVERSION "89:92M"
#define BUILDVERSION "89:93M"

0 comments on commit 0ca0db5

Please sign in to comment.