Merges, and cl_writecfg now works in nq.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-05-19 20:57:29 +00:00
parent d55f9e4a4d
commit e9857d8213
7 changed files with 112 additions and 41 deletions

View file

@ -1,4 +1,3 @@
/* /*
cl_main.c cl_main.c
@ -51,13 +50,10 @@
byte *vid_colormap; byte *vid_colormap;
// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
// these two are not intended to be set directly // these two are not intended to be set directly
cvar_t *cl_name; cvar_t *cl_name;
cvar_t *writecfg; cvar_t *cl_writecfg;
cvar_t *cl_shownet; cvar_t *cl_shownet;
cvar_t *cl_nolerp; cvar_t *cl_nolerp;
@ -133,6 +129,8 @@ CL_InitCvars (void)
"swim/fly up/down speed"); "swim/fly up/down speed");
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL, cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL,
"turning speed"); "turning speed");
cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL,
"write config files?");
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL, cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
"show network packets. 0=off, 1=basic, 2=verbose"); "show network packets. 0=off, 1=basic, 2=verbose");
cl_nolerp = Cvar_Get ("cl_nolerp", "0", CVAR_NONE, NULL, cl_nolerp = Cvar_Get ("cl_nolerp", "0", CVAR_NONE, NULL,

View file

@ -1,7 +1,7 @@
/* /*
com.c com.c
@description@ misc functions used in client and server
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
@ -75,9 +75,10 @@ COM_CheckRegistered (void)
void void
COM_Init () COM_Init (void)
{ {
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL, "None"); registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
"Is the game the registered version. 1 yes 0 no");
cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, Cvar_Info, "None"); cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, Cvar_Info, "None");
Cmd_AddCommand ("path", COM_Path_f, "No Description"); Cmd_AddCommand ("path", COM_Path_f, "No Description");

View file

@ -50,9 +50,9 @@
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "client.h"
#include "chase.h" #include "chase.h"
#include "game.h" #include "client.h"
//#include "game.h"
#include "glquake.h" #include "glquake.h"
#include "r_cvar.h" #include "r_cvar.h"
#include "r_dynamic.h" #include "r_dynamic.h"
@ -652,7 +652,7 @@ R_DrawAliasModel (entity_t *e)
} }
// clamp lighting so it doesn't overbright as much // clamp lighting so it doesn't overbright as much
shadelight = min (shadelight, 200); shadelight = min (shadelight, 100); // was 200
// never allow players to go totally black // never allow players to go totally black
if (strequal (clmodel->name, "progs/player.mdl")) { if (strequal (clmodel->name, "progs/player.mdl")) {
@ -1080,7 +1080,10 @@ R_RenderScene (void)
R_RenderDlights (); R_RenderDlights ();
} }
void R_RenderBrushPoly (msurface_t *fa); void R_RenderBrushPoly (msurface_t *fa);
void void
R_Mirror (void) R_Mirror (void)
{ {
@ -1093,9 +1096,8 @@ R_Mirror (void)
memcpy (r_base_world_matrix, r_world_matrix, sizeof (r_base_world_matrix)); memcpy (r_base_world_matrix, r_world_matrix, sizeof (r_base_world_matrix));
d = d = DotProduct (r_refdef.vieworg, mirror_plane->normal) -
DotProduct (r_refdef.vieworg, mirror_plane->dist;
mirror_plane->normal) - mirror_plane->dist;
VectorMA (r_refdef.vieworg, -2 * d, mirror_plane->normal, r_refdef.vieworg); VectorMA (r_refdef.vieworg, -2 * d, mirror_plane->normal, r_refdef.vieworg);
d = DotProduct (vpn, mirror_plane->normal); d = DotProduct (vpn, mirror_plane->normal);
@ -1157,7 +1159,7 @@ R_RenderView (void)
if (!r_worldentity.model || !cl.worldmodel) if (!r_worldentity.model || !cl.worldmodel)
Sys_Error ("R_RenderView: NULL worldmodel"); Sys_Error ("R_RenderView: NULL worldmodel");
// glFinish (); // glFinish ();
mirror = false; mirror = false;

View file

@ -1,4 +1,3 @@
/* /*
host.c host.c
@ -73,28 +72,29 @@ Memory is cleared / released when a server or client begins, not when they end.
extern int fps_count; extern int fps_count;
qboolean msg_suppress_1 = 0; qboolean msg_suppress_1 = 0;
quakeparms_t host_parms; quakeparms_t host_parms;
qboolean host_initialized; // true if into command execution qboolean host_initialized; // true if into command execution
double host_frametime; double host_frametime;
double host_time; double host_time;
double realtime; // without any filtering or bounding double realtime; // without any filtering or bounding
double oldrealtime; // last frame run double oldrealtime; // last frame run
int host_framecount; int host_framecount;
int host_hunklevel;
int host_hunklevel; int minimum_memory;
int minimum_memory;
client_t *host_client; // current client client_t *host_client; // current client
jmp_buf host_abortserver; jmp_buf host_abortserver;
byte *vid_basepal; byte *vid_basepal;
extern cvar_t *cl_writecfg;
cvar_t *fs_globalcfg; cvar_t *fs_globalcfg;
cvar_t *fs_usercfg; cvar_t *fs_usercfg;
@ -161,7 +161,7 @@ Host_Error (char *error, ...)
Sys_Error ("Host_Error: recursively entered"); Sys_Error ("Host_Error: recursively entered");
inerror = true; inerror = true;
// SCR_EndLoadingPlaque (); // reenable screen updates // SCR_EndLoadingPlaque (); // reenable screen updates
va_start (argptr, error); va_start (argptr, error);
vsnprintf (string, sizeof (string), error, argptr); vsnprintf (string, sizeof (string), error, argptr);
@ -172,7 +172,7 @@ Host_Error (char *error, ...)
Host_ShutdownServer (false); Host_ShutdownServer (false);
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
Sys_Error ("Host_Error: %s\n", string); // dedicated servers exit Sys_Error ("Host_Error: %s\n", string); // dedicated servers exit
CL_Disconnect (); CL_Disconnect ();
cls.demonum = -1; cls.demonum = -1;
@ -257,8 +257,7 @@ Host_InitLocal (void)
Host_FindMaxClients (); Host_FindMaxClients ();
host_time = 1.0; // so a think at time 0 won't get host_time = 1.0; // so a think at time 0 won't get called
// called
} }
@ -274,8 +273,9 @@ Host_WriteConfiguration (void)
// dedicated servers initialize the host but don't parse and set the // dedicated servers initialize the host but don't parse and set the
// config.cfg cvars // config.cfg cvars
if (host_initialized & !isDedicated) { if (cl_writecfg->int_val && (host_initialized & !isDedicated)) {
f = Qopen (va ("%s/config.cfg", com_gamedir), "w"); char *path = va ("%s/config.cfg", com_gamedir);
f = Qopen (path, "w");
if (!f) { if (!f) {
Con_Printf ("Couldn't write config.cfg.\n"); Con_Printf ("Couldn't write config.cfg.\n");
return; return;

View file

@ -145,9 +145,7 @@ cvar_t *localid;
static qboolean allowremotecmd = true; static qboolean allowremotecmd = true;
// /* info mirrors */
// info mirrors
//
cvar_t *password; cvar_t *password;
cvar_t *spectator; cvar_t *spectator;
cvar_t *cl_name; cvar_t *cl_name;
@ -1241,6 +1239,8 @@ CL_Init_Cvars (void)
"swim/fly up/down speed"); "swim/fly up/down speed");
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL, cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL,
"turning speed"); "turning speed");
cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL,
"write config files?");
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL, cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
"show network packets. 0=off, 1=basic, 2=verbose"); "show network packets. 0=off, 1=basic, 2=verbose");
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode"); cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode");
@ -1272,8 +1272,6 @@ CL_Init_Cvars (void)
"display realtime frames per second"); "display realtime frames per second");
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL, show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
"display the current time"); "display the current time");
cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL,
"write config files?");
cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE, cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE,
NULL, "If this and cl_predict_players are " NULL, "If this and cl_predict_players are "
"0, no player prediction is done"); "0, no player prediction is done");

View file

@ -91,5 +91,5 @@ void
COM_Init_Cvars (void) COM_Init_Cvars (void)
{ {
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL, registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
"Is the game the registered version. 1 yes 0 no"); "Is the game the registered version. 1 yes 0 no");
} }

View file

@ -54,6 +54,7 @@
#include "cl_cam.h" #include "cl_cam.h"
#include "cl_main.h" #include "cl_main.h"
#include "cl_parse.h" //FIXME CL_NewTranslation #include "cl_parse.h" //FIXME CL_NewTranslation
#include "cl_tent.h" // only for mirror support
#include "glquake.h" #include "glquake.h"
#include "r_cvar.h" #include "r_cvar.h"
#include "r_dynamic.h" #include "r_dynamic.h"
@ -651,7 +652,7 @@ R_DrawAliasModel (entity_t *e)
} }
// clamp lighting so it doesn't overbright as much // clamp lighting so it doesn't overbright as much
shadelight = min (shadelight, 100); shadelight = min (shadelight, 100); // was 200
// never allow players to go totally black // never allow players to go totally black
if (strequal (clmodel->name, "progs/player.mdl")) { if (strequal (clmodel->name, "progs/player.mdl")) {
@ -1077,6 +1078,72 @@ R_RenderScene (void)
R_RenderDlights (); R_RenderDlights ();
} }
void R_RenderBrushPoly (msurface_t *fa);
void
R_Mirror (void)
{
#if 0
float d;
msurface_t *s;
entity_t **ent;
if (!mirror)
return;
memcpy (r_base_world_matrix, r_world_matrix, sizeof (r_base_world_matrix));
d = DotProduct (r_refdef.vieworg, mirror_plane->normal) -
mirror_plane->dist;
VectorMA (r_refdef.vieworg, -2 * d, mirror_plane->normal, r_refdef.vieworg);
d = DotProduct (vpn, mirror_plane->normal);
VectorMA (vpn, -2 * d, mirror_plane->normal, vpn);
r_refdef.viewangles[0] = -asin (vpn[2]) / M_PI * 180;
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0]) / M_PI * 180;
r_refdef.viewangles[2] = -r_refdef.viewangles[2];
ent = CL_NewTempEntity();
if (ent)
*ent = &cl_entities[cl.viewentity];
gldepthmin = 0.5;
gldepthmax = 1;
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
R_RenderScene ();
R_DrawWaterSurfaces ();
gldepthmin = 0;
gldepthmax = 1;//XXX 0.5;
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
// blend on top
glMatrixMode (GL_PROJECTION);
if (mirror_plane->normal[2])
glScalef (1, -1, 1);
else
glScalef (-1, 1, 1);
glCullFace (GL_FRONT);
glMatrixMode (GL_MODELVIEW);
glLoadMatrixf (r_base_world_matrix);
glColor4f (1, 1, 1, r_mirroralpha->value);
s = cl.worldmodel->textures[mirrortexturenum]->texturechain;
for (; s; s = s->texturechain)
R_RenderBrushPoly (s);
cl.worldmodel->textures[mirrortexturenum]->texturechain = NULL;
glColor4f (1, 1, 1, 1);
#endif
}
/* /*
R_RenderView R_RenderView
@ -1091,7 +1158,9 @@ R_RenderView (void)
if (!r_worldentity.model || !cl.worldmodel) if (!r_worldentity.model || !cl.worldmodel)
Sys_Error ("R_RenderView: NULL worldmodel"); Sys_Error ("R_RenderView: NULL worldmodel");
// glFinish (); // glFinish ();
mirror = false;
R_Clear (); R_Clear ();
@ -1105,4 +1174,7 @@ R_RenderView (void)
R_DrawParticles (); R_DrawParticles ();
R_DrawViewModel (); R_DrawViewModel ();
// render mirror view
R_Mirror ();
} }