mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 17:01:53 +00:00
Big cleanup of Host_Init.
Eventually, all init functions will chain to their dependencies.
This commit is contained in:
parent
0086fee233
commit
890963423b
4 changed files with 101 additions and 287 deletions
|
@ -316,8 +316,10 @@ extern int fps_count;
|
|||
extern void (*write_angles) (sizebuf_t *sb, const vec3_t angles);
|
||||
|
||||
// cl_main
|
||||
void CL_Init (void);
|
||||
struct cbuf_s;
|
||||
void CL_Init (struct cbuf_s *cbuf);
|
||||
void CL_InitCvars (void);
|
||||
void CL_Shutdown (void);
|
||||
|
||||
void CL_EstablishConnection (const char *host);
|
||||
void CL_Signon1 (void);
|
||||
|
|
|
@ -32,9 +32,11 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
"$Id$";
|
||||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/cdaudio.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
|
@ -47,13 +49,16 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/va.h"
|
||||
|
||||
#include "chase.h"
|
||||
#include "cl_skin.h"
|
||||
#include "client.h"
|
||||
#include "clview.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "host.h"
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "server.h"
|
||||
#include "sbar.h"
|
||||
|
||||
byte *vid_colormap;
|
||||
|
||||
|
@ -85,9 +90,59 @@ int fps_count;
|
|||
client_static_t cls;
|
||||
client_state_t cl;
|
||||
|
||||
/*
|
||||
CL_WriteConfiguration
|
||||
|
||||
Writes key bindings and archived cvars to config.cfg
|
||||
*/
|
||||
static void
|
||||
CL_WriteConfiguration (void)
|
||||
{
|
||||
QFile *f;
|
||||
|
||||
// dedicated servers initialize the host but don't parse and set the
|
||||
// config.cfg cvars
|
||||
if (host_initialized && !isDedicated && cl_writecfg->int_val) {
|
||||
char *path = va ("%s/config.cfg", qfs_gamedir->dir.def);
|
||||
f = QFS_WOpen (path, 0);
|
||||
if (!f) {
|
||||
Sys_Printf ("Couldn't write config.cfg.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Key_WriteBindings (f);
|
||||
Cvar_WriteVariables (f);
|
||||
|
||||
Qclose (f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CL_Shutdown (void)
|
||||
{
|
||||
CL_WriteConfiguration ();
|
||||
CDAudio_Shutdown ();
|
||||
S_Shutdown ();
|
||||
IN_Shutdown ();
|
||||
VID_Shutdown ();
|
||||
}
|
||||
|
||||
void
|
||||
CL_InitCvars (void)
|
||||
{
|
||||
Chase_Init_Cvars ();
|
||||
CL_Skin_Init_Cvars ();
|
||||
IN_Init_Cvars ();
|
||||
VID_Init_Cvars ();
|
||||
S_Init_Cvars ();
|
||||
Key_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
R_Particles_Init_Cvars ();
|
||||
Mod_Init_Cvars ();
|
||||
V_Init_Cvars ();
|
||||
|
||||
CL_Demo_Init ();
|
||||
|
||||
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
|
||||
"Show bonus flash on item pickup");
|
||||
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE,
|
||||
|
@ -452,13 +507,37 @@ Force_CenterView_f (void)
|
|||
}
|
||||
|
||||
void
|
||||
CL_Init (void)
|
||||
CL_Init (cbuf_t *cbuf)
|
||||
{
|
||||
byte *basepal;
|
||||
|
||||
basepal = (byte *) QFS_LoadHunkFile ("gfx/palette.lmp");
|
||||
if (!basepal)
|
||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||
vid_colormap = (byte *) QFS_LoadHunkFile ("gfx/colormap.lmp");
|
||||
if (!vid_colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
Key_Init (cbuf);
|
||||
VID_Init (basepal);
|
||||
Draw_Init ();
|
||||
SCR_Init ();
|
||||
R_Init ();
|
||||
|
||||
S_Init (&cl.worldmodel, &viewentity, &host_frametime);
|
||||
|
||||
CDAudio_Init ();
|
||||
Sbar_Init ();
|
||||
IN_Init ();
|
||||
|
||||
CL_SetState (ca_disconnected);
|
||||
CL_Skin_Init ();
|
||||
SZ_Alloc (&cls.message, 1024);
|
||||
|
||||
CL_Input_Init ();
|
||||
CL_TEnts_Init ();
|
||||
CL_ClearState ();
|
||||
V_Init ();
|
||||
|
||||
Cmd_AddCommand ("entities", CL_PrintEntities_f, "No Description");
|
||||
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "No Description");
|
||||
|
|
101
nq/source/host.c
101
nq/source/host.c
|
@ -28,27 +28,25 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static __attribute__ ((used)) const char rcsid[] =
|
||||
"$Id$";
|
||||
static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include "unistd.h"
|
||||
#endif
|
||||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/idparse.h"
|
||||
#include "QF/cdaudio.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/idparse.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/vid.h"
|
||||
|
@ -58,12 +56,8 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "chase.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "sbar.h"
|
||||
#include "server.h"
|
||||
#include "sv_progs.h"
|
||||
#include "cl_skin.h"
|
||||
#include "clview.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -108,8 +102,6 @@ client_t *host_client; // current client
|
|||
|
||||
jmp_buf host_abortserver;
|
||||
|
||||
byte *host_basepal;
|
||||
|
||||
cvar_t *host_mem_size;
|
||||
|
||||
cvar_t *host_framerate;
|
||||
|
@ -300,33 +292,6 @@ Host_InitLocal (void)
|
|||
host_time = 1.0; // so a think at time 0 won't get called
|
||||
}
|
||||
|
||||
/*
|
||||
Host_WriteConfiguration
|
||||
|
||||
Writes key bindings and archived cvars to config.cfg
|
||||
*/
|
||||
static void
|
||||
Host_WriteConfiguration (void)
|
||||
{
|
||||
QFile *f;
|
||||
|
||||
// dedicated servers initialize the host but don't parse and set the
|
||||
// config.cfg cvars
|
||||
if (host_initialized && !isDedicated && cl_writecfg->int_val) {
|
||||
char *path = va ("%s/config.cfg", qfs_gamedir->dir.def);
|
||||
f = QFS_WOpen (path, 0);
|
||||
if (!f) {
|
||||
Sys_Printf ("Couldn't write config.cfg.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Key_WriteBindings (f);
|
||||
Cvar_WriteVariables (f);
|
||||
|
||||
Qclose (f);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
SV_ClientPrintf
|
||||
|
||||
|
@ -849,7 +814,7 @@ check_quakerc (void)
|
|||
}
|
||||
|
||||
static void
|
||||
CL_Init_Memory (void)
|
||||
Host_Init_Memory (void)
|
||||
{
|
||||
int mem_parm = COM_CheckParm ("-mem");
|
||||
int mem_size;
|
||||
|
@ -895,32 +860,24 @@ Host_Init (void)
|
|||
cmd_source = src_command;
|
||||
|
||||
Sys_Init ();
|
||||
GIB_Init (true);
|
||||
COM_ParseConfig ();
|
||||
|
||||
CL_Init_Memory ();
|
||||
GIB_Init (true);
|
||||
|
||||
Host_Init_Memory ();
|
||||
|
||||
Game_Init ();
|
||||
PI_Init ();
|
||||
|
||||
Chase_Init_Cvars ();
|
||||
CL_Skin_Init_Cvars ();
|
||||
CL_InitCvars ();
|
||||
IN_Init_Cvars ();
|
||||
VID_Init_Cvars ();
|
||||
S_Init_Cvars ();
|
||||
Key_Init_Cvars ();
|
||||
Game_Init ();
|
||||
|
||||
if (!isDedicated)
|
||||
CL_InitCvars ();
|
||||
|
||||
PR_Init_Cvars ();
|
||||
SV_Progs_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
R_Particles_Init_Cvars ();
|
||||
Mod_Init_Cvars ();
|
||||
V_Init_Cvars ();
|
||||
|
||||
PR_Init ();
|
||||
|
||||
V_Init ();
|
||||
|
||||
if (isDedicated) {
|
||||
PI_RegisterPlugins (server_plugin_list);
|
||||
Con_Init ("server");
|
||||
|
@ -941,39 +898,15 @@ Host_Init (void)
|
|||
NET_Init ();
|
||||
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
Key_Init (host_cbuf);
|
||||
Mod_Init ();
|
||||
|
||||
CL_Demo_Init ();
|
||||
|
||||
SV_Progs_Init ();
|
||||
SV_Init ();
|
||||
|
||||
Sys_Printf ("%4.1f megabyte heap\n", host_mem_size->value);
|
||||
|
||||
if (cls.state != ca_dedicated) {
|
||||
host_basepal = (byte *) QFS_LoadHunkFile ("gfx/palette.lmp");
|
||||
if (!host_basepal)
|
||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||
vid_colormap = (byte *) QFS_LoadHunkFile ("gfx/colormap.lmp");
|
||||
if (!vid_colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
VID_Init (host_basepal);
|
||||
Draw_Init ();
|
||||
SCR_Init ();
|
||||
R_Init ();
|
||||
|
||||
S_Init (&cl.worldmodel, &viewentity, &host_frametime);
|
||||
|
||||
CDAudio_Init ();
|
||||
Sbar_Init ();
|
||||
CL_Init ();
|
||||
IN_Init ();
|
||||
|
||||
CL_SetState (ca_disconnected);
|
||||
CL_Skin_Init ();
|
||||
}
|
||||
if (cls.state != ca_dedicated)
|
||||
CL_Init (host_cbuf);
|
||||
|
||||
CL_UpdateScreen (cl.time);
|
||||
CL_UpdateScreen (cl.time);
|
||||
|
@ -1017,14 +950,10 @@ Host_Shutdown (void)
|
|||
}
|
||||
isdown = true;
|
||||
|
||||
Host_WriteConfiguration ();
|
||||
|
||||
NET_Shutdown ();
|
||||
if (cls.state != ca_dedicated) {
|
||||
CDAudio_Shutdown ();
|
||||
S_Shutdown ();
|
||||
IN_Shutdown ();
|
||||
VID_Shutdown ();
|
||||
CL_Shutdown ();
|
||||
}
|
||||
Con_Shutdown ();
|
||||
}
|
||||
|
|
|
@ -28,32 +28,14 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static __attribute__ ((used)) const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
||||
|
||||
#include "QF/cdaudio.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/csqc.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "chase.h"
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "sbar.h"
|
||||
#include "server.h"
|
||||
#include "cl_skin.h"//FIXME
|
||||
#include "clview.h" //FIXME
|
||||
|
||||
client_state_t cl;
|
||||
client_static_t cls;
|
||||
|
@ -93,17 +75,6 @@ CL_Cmd_ForwardToServer (void)
|
|||
{
|
||||
}
|
||||
|
||||
int
|
||||
CDAudio_Init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
CDAudio_Shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CDAudio_Update (void)
|
||||
{
|
||||
|
@ -125,63 +96,18 @@ CL_EstablishConnection (const char *host)
|
|||
}
|
||||
|
||||
void
|
||||
CL_Init (void)
|
||||
CL_Shutdown ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_Init_Entity (entity_t *ent)
|
||||
CL_Init (struct cbuf_s *cbuf)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
color_f (void)
|
||||
{
|
||||
int top, bottom;
|
||||
char playercolor;
|
||||
|
||||
if (Cmd_Argc () <= 1) {
|
||||
Sys_Printf ("\"color\" is \"%d %d\"\n", (host_client->colors) >> 4,
|
||||
(host_client->colors) & 0x0f);
|
||||
Sys_Printf ("color <0-13> [0-13]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc () == 2)
|
||||
top = bottom = atoi (Cmd_Argv (1));
|
||||
else {
|
||||
top = atoi (Cmd_Argv (1));
|
||||
bottom = atoi (Cmd_Argv (2));
|
||||
}
|
||||
|
||||
top = min (top & 15, 13);
|
||||
bottom = min (bottom & 15, 13);
|
||||
|
||||
playercolor = top * 16 + bottom;
|
||||
|
||||
host_client->colors = playercolor;
|
||||
SVfloat (host_client->edict, team) = bottom + 1;
|
||||
|
||||
// send notification to all clients
|
||||
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
|
||||
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
|
||||
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
|
||||
}
|
||||
|
||||
void
|
||||
CL_InitCvars (void)
|
||||
{
|
||||
cl_name = Cvar_Get ("_cl_name", "player", CVAR_ARCHIVE, NULL, "");
|
||||
cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL, "");
|
||||
cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, NULL,
|
||||
"How much your screen tilts when strafing");
|
||||
cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL,
|
||||
"How quickly you straighten out after strafing");
|
||||
|
||||
Cmd_AddCommand ("color", color_f, "The pant and shirt color (color shirt "
|
||||
"pants) Note that if only shirt color is given, pants "
|
||||
"will match");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -189,12 +115,6 @@ CL_NextDemo (void)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_Demo_Init (void)
|
||||
{
|
||||
demo_speed = Cvar_Get ("demo_speed", "1", CVAR_NONE, NULL, "");
|
||||
}
|
||||
|
||||
int
|
||||
CL_ReadFromServer (void)
|
||||
{
|
||||
|
@ -206,72 +126,21 @@ CL_SendCmd (void)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_SetState (cactive_t state)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_StopPlayback (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Chase_Init_Cvars (void)
|
||||
{
|
||||
chase_active = Cvar_Get ("chase_active", "0", CVAR_NONE, NULL, "None");
|
||||
}
|
||||
|
||||
void
|
||||
D_FlushCaches (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Draw_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_Skin_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CL_Skin_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
IN_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
IN_ProcessEvents (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
IN_Shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Key_Init (struct cbuf_s *cb)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Key_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Key_WriteBindings (QFile *f)
|
||||
{
|
||||
|
@ -282,77 +151,12 @@ R_DecayLights (double frametime)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
R_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
R_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
R_Particles_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SCR_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_Init (struct model_s **worldmodel, int *viewentity, double *host_frametime)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_Shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_Update (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right,
|
||||
const vec3_t v_up)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Sbar_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
VID_Init (unsigned char *palette)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
VID_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
VID_Shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
V_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
V_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
S_BlockSound (void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue