Adding a few tiny optimisations and playdemo working on qwd files again.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@470 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-11-18 17:55:04 +00:00
parent 2fc07546f0
commit ac284a1b94
13 changed files with 626 additions and 51 deletions

View file

@ -152,6 +152,7 @@ qboolean CL_GetDemoMessage (void)
float demotime;
qbyte c, msecsadded;
usercmd_t *pcmd;
q1usercmd_t q1cmd;
static float prevtime = 0;
@ -308,7 +309,7 @@ readnext:
// user sent input
i = cls.netchan.outgoing_sequence & UPDATE_MASK;
pcmd = &cl.frames[i].cmd[0];
r = fread (pcmd, sizeof(*pcmd), 1, cls.demofile);
r = fread (&q1cmd, sizeof(q1cmd), 1, cls.demofile);
if (r != 1)
{
CL_StopPlayback ();
@ -316,10 +317,17 @@ readnext:
}
// byte order stuff
for (j = 0; j < 3; j++)
pcmd->angles[j] = LittleFloat(pcmd->angles[j]);
pcmd->forwardmove = LittleShort(pcmd->forwardmove);
pcmd->sidemove = LittleShort(pcmd->sidemove);
pcmd->upmove = LittleShort(pcmd->upmove);
{
q1cmd.angles[j] = LittleFloat(q1cmd.angles[j]);
pcmd->angles[j] = ((int)(q1cmd.angles[j]*65536.0/360)&65535);
}
pcmd->forwardmove = q1cmd.forwardmove = LittleShort(q1cmd.forwardmove);
pcmd->sidemove = q1cmd.sidemove = LittleShort(q1cmd.sidemove);
pcmd->upmove = q1cmd.upmove = LittleShort(q1cmd.upmove);
pcmd->msec = q1cmd.msec;
pcmd->buttons = q1cmd.buttons;
cl.frames[i].senttime = demotime;
cl.frames[i].receivedtime = -1; // we haven't gotten a reply yet
cls.netchan.outgoing_sequence++;

View file

@ -78,6 +78,8 @@ cvar_t d_smooth = {"d_smooth", "0"};
#endif
cvar_t gl_skyboxdist = {"gl_skyboxdist", "2300"};
cvar_t r_vertexdlights = {"r_vertexdlights", "1"};
extern cvar_t r_dodgytgafiles;
cvar_t r_nolerp = {"r_nolerp", "0"};
@ -154,6 +156,8 @@ cvar_t gl_ati_truform = {"gl_ati_truform", "0"};
cvar_t gl_ati_truform_type = {"gl_ati_truform_type", "1"};
cvar_t gl_ati_truform_tesselation = {"gl_ati_truform_tesselation", "3"};
cvar_t gl_lateswap = {"gl_lateswap", "1"};
cvar_t scr_sshot_type = {"scr_sshot_type", "jpg"};
@ -259,6 +263,7 @@ void GLRenderer_Init(void)
Cvar_Register (&gl_playermip, GLRENDEREROPTIONS);
Cvar_Register (&gl_nocolors, GLRENDEREROPTIONS);
Cvar_Register (&gl_finish, GLRENDEREROPTIONS);
Cvar_Register (&gl_lateswap, GLRENDEREROPTIONS);
Cvar_Register (&r_shadows, GLRENDEREROPTIONS);
Cvar_Register (&r_noaliasshadows, GLRENDEREROPTIONS);

View file

@ -706,6 +706,15 @@ typedef struct usercmd_s
qbyte impulse;
qbyte lightlevel;
} usercmd_t;
typedef struct q1usercmd_s
{
qbyte msec;
vec3_t angles;
short forwardmove, sidemove, upmove;
qbyte buttons;
qbyte impulse;
} q1usercmd_t;
#define SHORT2ANGLE(x) (x) * (360.0/65536)

File diff suppressed because it is too large Load diff

View file

@ -59,6 +59,7 @@ int numTempNormals;
vec3_t *tempNormals;
extern cvar_t gl_ati_truform;
extern cvar_t r_vertexdlights;
typedef struct {
int ofs_indexes;
@ -840,8 +841,6 @@ void R_DrawGAliasModel (entity_t *e)
float entScale;
vec3_t lightdir;
int pervertexdlights = 1;
float tmatrix[3][4];
currententity = e;
@ -868,7 +867,7 @@ void R_DrawGAliasModel (entity_t *e)
lightdir[2] = 1;
}
if (!pervertexdlights)
if (!r_vertexdlights.value)
{
for (i=0 ; i<MAX_DLIGHTS ; i++)
{
@ -1139,7 +1138,7 @@ void R_DrawGAliasModel (entity_t *e)
while(inf)
{
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha);
if (pervertexdlights)
if (r_vertexdlights.value)
R_GAliasAddDlights(&mesh, e->origin, e->angles);
skin = GL_ChooseSkin(inf, clmodel->name, e);
c_alias_polys += mesh.numindexes/3;

View file

@ -81,7 +81,19 @@ void GL_FlushBinds(void)
}
}
typedef vec3_t mat3_t[3];
void Matrix3_Multiply (mat3_t in1, mat3_t in2, mat3_t out)
{
out[0][0] = in1[0][0]*in2[0][0] + in1[0][1]*in2[1][0] + in1[0][2]*in2[2][0];
out[0][1] = in1[0][0]*in2[0][1] + in1[0][1]*in2[1][1] + in1[0][2]*in2[2][1];
out[0][2] = in1[0][0]*in2[0][2] + in1[0][1]*in2[1][2] + in1[0][2]*in2[2][2];
out[1][0] = in1[1][0]*in2[0][0] + in1[1][1]*in2[1][0] + in1[1][2]*in2[2][0];
out[1][1] = in1[1][0]*in2[0][1] + in1[1][1]*in2[1][1] + in1[1][2]*in2[2][1];
out[1][2] = in1[1][0]*in2[0][2] + in1[1][1]*in2[1][2] + in1[1][2]*in2[2][2];
out[2][0] = in1[2][0]*in2[0][0] + in1[2][1]*in2[1][0] + in1[2][2]*in2[2][0];
out[2][1] = in1[2][0]*in2[0][1] + in1[2][1]*in2[1][1] + in1[2][2]*in2[2][1];
out[2][2] = in1[2][0]*in2[0][2] + in1[2][1]*in2[1][2] + in1[2][2]*in2[2][2];
}
@ -802,7 +814,6 @@ void VectorNormalizeFast( vec3_t v )
typedef vec3_t mat3_t[3];
mat3_t axisDefault={{1, 0, 0},
{0, 1, 0},
{0, 0, 1}};
@ -827,19 +838,6 @@ void Matrix3_Multiply_Vec3 (mat3_t a, vec3_t b, vec3_t product)
product[2] = a[2][0]*b[0] + a[2][1]*b[1] + a[2][2]*b[2];
}
void Matrix3_Multiply (mat3_t in1, mat3_t in2, mat3_t out)
{
out[0][0] = in1[0][0]*in2[0][0] + in1[0][1]*in2[1][0] + in1[0][2]*in2[2][0];
out[0][1] = in1[0][0]*in2[0][1] + in1[0][1]*in2[1][1] + in1[0][2]*in2[2][1];
out[0][2] = in1[0][0]*in2[0][2] + in1[0][1]*in2[1][2] + in1[0][2]*in2[2][2];
out[1][0] = in1[1][0]*in2[0][0] + in1[1][1]*in2[1][0] + in1[1][2]*in2[2][0];
out[1][1] = in1[1][0]*in2[0][1] + in1[1][1]*in2[1][1] + in1[1][2]*in2[2][1];
out[1][2] = in1[1][0]*in2[0][2] + in1[1][1]*in2[1][2] + in1[1][2]*in2[2][2];
out[2][0] = in1[2][0]*in2[0][0] + in1[2][1]*in2[1][0] + in1[2][2]*in2[2][0];
out[2][1] = in1[2][0]*in2[0][1] + in1[2][1]*in2[1][1] + in1[2][2]*in2[2][1];
out[2][2] = in1[2][0]*in2[0][2] + in1[2][1]*in2[1][2] + in1[2][2]*in2[2][2];
}
int Matrix3_Compare(mat3_t in, mat3_t out)
{
return memcmp(in, out, sizeof(mat3_t));

View file

@ -807,6 +807,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
TRACE(("dbg: GLDraw_ReInit: GL_EndRendering\n"));
GL_EndRendering ();
GL_DoSwap();
#ifdef Q3SHADERS

View file

@ -1402,6 +1402,8 @@ void PPL_BaseTextures(model_t *model)
msurface_t *s;
texture_t *t;
GL_DoSwap();
glDisable(GL_BLEND);
glColor4f(1,1,1, 1);
// glDepthFunc(GL_LESS);

View file

@ -208,6 +208,7 @@ void R_Envmap_f (void)
glDrawBuffer (GL_BACK);
glReadBuffer (GL_BACK);
GL_EndRendering ();
GL_DoSwap();
}
@ -934,6 +935,7 @@ void GLR_TimeRefresh_f (void)
glDrawBuffer (GL_BACK);
GL_EndRendering ();
GL_DoSwap();
}
#ifndef SWQUAKE

View file

@ -117,6 +117,7 @@ void GLSCR_UpdateScreen (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
SCR_DrawLoading ();
GL_EndRendering ();
GL_DoSwap();
return;
}
}
@ -144,6 +145,7 @@ void GLSCR_UpdateScreen (void)
#endif
GLR_BrightenScreen();
GL_EndRendering ();
GL_DoSwap();
return;
}
#endif
@ -156,6 +158,7 @@ void GLSCR_UpdateScreen (void)
#endif
GLR_BrightenScreen();
GL_EndRendering ();
GL_DoSwap();
return;
}
@ -180,6 +183,8 @@ void GLSCR_UpdateScreen (void)
SCR_SetUpToDrawConsole ();
if (cl.worldmodel && uimenu != 1)
V_RenderView ();
else
GL_DoSwap();
GL_Set2D ();
@ -252,7 +257,7 @@ void GLSCR_UpdateScreen (void)
#if defined(_WIN32) && defined(RGLQUAKE)
Media_RecordFrame();
#endif
GL_EndRendering ();
GL_EndRendering ();
}

View file

@ -158,6 +158,7 @@ extern cvar_t _vid_wait_override;
extern cvar_t vid_stretch_by_2;
extern cvar_t _windowed_mouse;
extern cvar_t vid_hardwaregamma;
extern cvar_t gl_lateswap;
int window_center_x, window_center_y, window_x, window_y, window_width, window_height;
RECT window_rect;
@ -802,8 +803,13 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height)
// glViewport (*x, *y, *width, *height);
}
void GL_EndRendering (void)
qboolean screenflush;
void GL_DoSwap (void)
{
if (!screenflush)
return;
screenflush = 0;
if (!scr_skipupdate || block_drawing)
qSwapBuffers(maindc);
@ -835,6 +841,13 @@ void GL_EndRendering (void)
}
}
void GL_EndRendering (void)
{
screenflush = true;
if (!gl_lateswap.value)
GL_DoSwap();
}
void GLVID_SetPalette (unsigned char *palette)
{
qbyte *pal;

View file

@ -25,6 +25,8 @@ int PlaneTypeForNormal ( vec3_t normal );
//Matthew S Fell (msfell@aol.com)
//Unofficial Doom Specs
//(aol suck)
void Doom_SetHullFuncs(hull_t *hull);
void Doom_SetModelFunc(model_t *mod);

View file

@ -42,7 +42,12 @@ int numCompilerConstants;
char *pr_punctuation[] =
// longer symbols must be before a shorter partial match
{"&&", "||", "<=", ">=","==", "!=", "/=", "*=", "+=", "-=", "(+)", "(-)", "++", "--", "::", ";", ",", "!", "*", "/", "(", ")", "-", "+", "=", "[", "]", "{", "}", "...", "..", ".", "<<", "<", ">>", ">" , "#" , "@", "&" , "|", "^", ":", NULL};
{"&&", "||", "<=", ">=","==", "!=", "/=", "*=", "+=", "-=", "|=", "(+)", "(-)", "++", "--", "->", "::", ";", ",", "!", "*", "/", "(", ")", "-", "+", "=", "[", "]", "{", "}", "...", "..", ".", "<<", "<", ">>", ">" , "#" , "@", "&" , "|", "^", ":", NULL};
char *pr_punctuationremap[] = //a nice bit of evilness.
//|= -> (+)
//-> -> .
{"&&", "||", "<=", ">=","==", "!=", "/=", "*=", "+=", "-=", "(+)","(+)", "(-)", "++", "--", ".", "::", ";", ",", "!", "*", "/", "(", ")", "-", "+", "=", "[", "]", "{", "}", "...", "..", ".", "<<", "<", ">>", ">" , "#" , "@", "&" , "|", "^", ":", NULL};
// simple types. function types are dynamically allocated
QCC_type_t *type_void;// = {ev_void/*, &def_void*/};
@ -1299,7 +1304,7 @@ void QCC_PR_LexPunctuation (void)
len = strlen(p);
if (!strncmp(p, pr_file_p, len) )
{
strcpy (pr_token, p);
strcpy (pr_token, pr_punctuationremap[i]);
if (p[0] == '{')
pr_bracelevel++;
else if (p[0] == '}')
@ -2117,7 +2122,7 @@ void QCC_PR_Lex (void)
// if the first character is a valid identifier, parse until a non-id
// character is reached
if ( c == '~' )
if ( c == '~' || c == '%') //let's see which one we make into an operator first... possibly both...
{
pr_file_p++;
pr_token_type = tt_immediate;