mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
Make the init process more dependency based.
Most subsystems that depend on other subsystems now call the init functions themselves. This makes for much cleaner client initialization (more work needs to be done for the server).
This commit is contained in:
parent
c4e08bc152
commit
f800e79a38
10 changed files with 91 additions and 86 deletions
|
@ -42,7 +42,7 @@ extern viewdelta_t viewdelta;
|
|||
|
||||
struct cvar_s;
|
||||
|
||||
void IN_Init (void);
|
||||
void IN_Init (struct cbuf_s *cbuf);
|
||||
void IN_Init_Cvars (void);
|
||||
|
||||
void IN_Shutdown (void);
|
||||
|
|
|
@ -50,6 +50,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/draw.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "QF/render.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/skin.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
@ -146,6 +147,7 @@ R_Init (void)
|
|||
"Load a pointfile to determine map leaks");
|
||||
Cmd_AddCommand ("loadsky", R_LoadSky_f, "Load a skybox");
|
||||
|
||||
SCR_Init ();
|
||||
R_InitBubble ();
|
||||
|
||||
GDT_Init ();
|
||||
|
|
|
@ -256,6 +256,7 @@ R_RenderView (void)
|
|||
VISIBLE void
|
||||
R_Init (void)
|
||||
{
|
||||
SCR_Init ();
|
||||
R_InitBsp ();
|
||||
R_InitAlias ();
|
||||
R_InitSprites ();
|
||||
|
|
|
@ -147,6 +147,7 @@ R_Init (void)
|
|||
// get stack position so we can guess if we are going to overflow
|
||||
r_stack_start = (byte *) & dummy;
|
||||
|
||||
SCR_Init ();
|
||||
R_SetFPCW ();
|
||||
#ifdef USE_INTEL_ASM
|
||||
R_InitVars ();
|
||||
|
|
|
@ -174,6 +174,7 @@ R_Init (void)
|
|||
// get stack position so we can guess if we are going to overflow
|
||||
r_stack_start = (byte *) & dummy;
|
||||
|
||||
SCR_Init ();
|
||||
R_InitTurb ();
|
||||
|
||||
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f, "Tests the current "
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static __attribute__ ((used)) const char rcsid[] =
|
||||
"$Id$";
|
||||
static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
|
@ -50,6 +49,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/in_event.h"
|
||||
#include "QF/input.h"
|
||||
|
@ -142,11 +142,11 @@ IN_Shutdown (void)
|
|||
}
|
||||
|
||||
void
|
||||
IN_Init (void)
|
||||
IN_Init (cbuf_t *cbuf)
|
||||
{
|
||||
IE_Init ();
|
||||
IN_LL_Init ();
|
||||
|
||||
Key_Init (cbuf);
|
||||
JOY_Init ();
|
||||
|
||||
in_mouse_x = in_mouse_y = 0.0;
|
||||
|
@ -156,6 +156,7 @@ void
|
|||
IN_Init_Cvars (void)
|
||||
{
|
||||
IE_Init_Cvars ();
|
||||
Key_Init_Cvars ();
|
||||
JOY_Init_Cvars ();
|
||||
in_grab = Cvar_Get ("in_grab", "0", CVAR_ARCHIVE, IN_UpdateGrab,
|
||||
"With this set to 1, quake will grab the mouse, "
|
||||
|
|
|
@ -129,16 +129,15 @@ CL_Shutdown (void)
|
|||
void
|
||||
CL_InitCvars (void)
|
||||
{
|
||||
Chase_Init_Cvars ();
|
||||
IN_Init_Cvars ();
|
||||
VID_Init_Cvars ();
|
||||
S_Init_Cvars ();
|
||||
Key_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
IN_Init_Cvars ();
|
||||
Mod_Init_Cvars ();
|
||||
V_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
S_Init_Cvars ();
|
||||
|
||||
CL_Demo_Init ();
|
||||
Chase_Init_Cvars ();
|
||||
V_Init_Cvars ();
|
||||
|
||||
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
|
||||
"Show bonus flash on item pickup");
|
||||
|
@ -511,26 +510,21 @@ CL_Init (cbuf_t *cbuf)
|
|||
if (!colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
Key_Init (cbuf);
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
VID_Init (basepal, colormap);
|
||||
IN_Init (cbuf);
|
||||
Draw_Init ();
|
||||
SCR_Init ();
|
||||
R_Init ();
|
||||
|
||||
S_Init (&cl.worldmodel, &viewentity, &host_frametime);
|
||||
|
||||
CDAudio_Init ();
|
||||
|
||||
Sbar_Init ();
|
||||
IN_Init ();
|
||||
|
||||
Skin_Init ();
|
||||
|
||||
CL_SetState (ca_disconnected);
|
||||
SZ_Alloc (&cls.message, 1024);
|
||||
|
||||
CL_Input_Init ();
|
||||
CL_TEnts_Init ();
|
||||
CL_ClearState ();
|
||||
|
||||
Skin_Init ();
|
||||
V_Init ();
|
||||
|
||||
Cmd_AddCommand ("entities", CL_PrintEntities_f, "No Description");
|
||||
|
@ -540,4 +534,7 @@ CL_Init (cbuf_t *cbuf)
|
|||
Cmd_AddCommand ("demolist", Con_Demolist_DEM_f, "List available demos");
|
||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
|
||||
"to be level");
|
||||
|
||||
SZ_Alloc (&cls.message, 1024);
|
||||
CL_SetState (ca_disconnected);
|
||||
}
|
||||
|
|
|
@ -863,6 +863,8 @@ Host_Init_Memory (void)
|
|||
|
||||
Sys_PageIn (mem_base, mem_size);
|
||||
Memory_Init (mem_base, mem_size);
|
||||
|
||||
Sys_Printf ("%4.1f megabyte heap\n", host_mem_size->value);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -874,9 +876,8 @@ Host_Init (void)
|
|||
cmd_source = src_command;
|
||||
|
||||
Sys_Init ();
|
||||
COM_ParseConfig ();
|
||||
|
||||
GIB_Init (true);
|
||||
COM_ParseConfig ();
|
||||
|
||||
Host_Init_Memory ();
|
||||
|
||||
|
@ -884,12 +885,12 @@ Host_Init (void)
|
|||
|
||||
Game_Init ();
|
||||
|
||||
if (!isDedicated)
|
||||
CL_InitCvars ();
|
||||
|
||||
PR_Init_Cvars ();
|
||||
SV_Progs_Init_Cvars ();
|
||||
|
||||
if (!isDedicated)
|
||||
CL_InitCvars ();
|
||||
|
||||
PR_Init ();
|
||||
|
||||
if (isDedicated) {
|
||||
|
@ -911,14 +912,10 @@ Host_Init (void)
|
|||
|
||||
NET_Init ();
|
||||
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
Mod_Init ();
|
||||
|
||||
SV_Progs_Init ();
|
||||
SV_Init ();
|
||||
|
||||
Sys_Printf ("%4.1f megabyte heap\n", host_mem_size->value);
|
||||
|
||||
if (cls.state != ca_dedicated)
|
||||
CL_Init (host_cbuf);
|
||||
|
||||
|
|
|
@ -84,6 +84,8 @@ SV_Init (void)
|
|||
{
|
||||
int i;
|
||||
|
||||
SV_Progs_Init ();
|
||||
|
||||
sv_maxvelocity = Cvar_Get ("sv_maxvelocity", "2000", CVAR_NONE, NULL,
|
||||
"None");
|
||||
sv_gravity = Cvar_Get ("sv_gravity", "800", CVAR_SERVERINFO, Cvar_Info,
|
||||
|
|
|
@ -396,7 +396,8 @@ CL_ClearState (void)
|
|||
S_StopAllSounds ();
|
||||
|
||||
// wipe the entire cl structure
|
||||
Info_Destroy (cl.serverinfo);
|
||||
if (cl.serverinfo)
|
||||
Info_Destroy (cl.serverinfo);
|
||||
memset (&cl, 0, sizeof (cl));
|
||||
r_force_fullscreen = 0;
|
||||
|
||||
|
@ -429,7 +430,8 @@ CL_ClearState (void)
|
|||
memset (cl_efrags, 0, sizeof (cl_efrags));
|
||||
memset (r_lightstyle, 0, sizeof (r_lightstyle));
|
||||
|
||||
dstring_clearstr (centerprint);
|
||||
if (centerprint)
|
||||
dstring_clearstr (centerprint);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1172,17 +1174,47 @@ CL_SetState (cactive_t state)
|
|||
void
|
||||
CL_Init (void)
|
||||
{
|
||||
CL_SetState (ca_disconnected);
|
||||
byte *basepal, *colormap;
|
||||
|
||||
Info_SetValueForStarKey (cls.userinfo, "*ver", QW_VERSION, 0);
|
||||
basepal = (byte *) QFS_LoadHunkFile ("gfx/palette.lmp");
|
||||
if (!basepal)
|
||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||
colormap = (byte *) QFS_LoadHunkFile ("gfx/colormap.lmp");
|
||||
if (!colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
VID_Init (basepal, colormap);
|
||||
IN_Init (cl_cbuf);
|
||||
Draw_Init ();
|
||||
Mod_Init ();
|
||||
R_Init ();
|
||||
S_Init (&cl.worldmodel, &viewentity, &host_frametime);
|
||||
CDAudio_Init ();
|
||||
|
||||
Sbar_Init ();
|
||||
|
||||
CL_Input_Init ();
|
||||
CL_Ents_Init ();
|
||||
CL_TEnts_Init ();
|
||||
CL_ClearState ();
|
||||
Pmove_Init ();
|
||||
|
||||
SL_Init ();
|
||||
|
||||
CL_Skin_Init ();
|
||||
Locs_Init ();
|
||||
V_Init ();
|
||||
|
||||
Info_SetValueForStarKey (cls.userinfo, "*ver", QW_VERSION, 0);
|
||||
|
||||
centerprint = dstring_newstr ();
|
||||
cls.servername = dstring_newstr ();
|
||||
cls.downloadtempname = dstring_newstr ();
|
||||
cls.downloadname = dstring_newstr ();
|
||||
cls.downloadurl = dstring_newstr ();
|
||||
cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
||||
|
||||
// register our commands
|
||||
Cmd_AddCommand ("version", CL_Version_f, "Report version information");
|
||||
Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing");
|
||||
|
@ -1240,6 +1272,8 @@ CL_Init (void)
|
|||
"server info");
|
||||
cl_player_health_e = GIB_Event_New ("player.health");
|
||||
cl_chat_e = GIB_Event_New ("chat");
|
||||
|
||||
CL_SetState (ca_disconnected);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1260,6 +1294,22 @@ cl_cmd_pkt_adr_f (cvar_t *var)
|
|||
static void
|
||||
CL_Init_Cvars (void)
|
||||
{
|
||||
VID_Init_Cvars ();
|
||||
IN_Init_Cvars ();
|
||||
Mod_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
S_Init_Cvars ();
|
||||
|
||||
CL_Cam_Init_Cvars ();
|
||||
CL_Input_Init_Cvars ();
|
||||
CL_Prediction_Init_Cvars ();
|
||||
Game_Init_Cvars ();
|
||||
Pmove_Init_Cvars ();
|
||||
Team_Init_Cvars ();
|
||||
V_Init_Cvars ();
|
||||
|
||||
cls.userinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
||||
|
||||
cl_model_crcs = Cvar_Get ("cl_model_crcs", "1", CVAR_ARCHIVE, NULL,
|
||||
"Controls setting of emodel and pmodel info "
|
||||
"vars. Required by some servers, but clearing "
|
||||
|
@ -1691,6 +1741,8 @@ CL_Init_Memory (void)
|
|||
|
||||
Sys_PageIn (mem_base, mem_size);
|
||||
Memory_Init (mem_base, mem_size);
|
||||
|
||||
Sys_Printf ("%4.1f megabyte heap.\n", cl_mem_size->value);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1714,8 +1766,6 @@ CL_Autoexec (int phase)
|
|||
void
|
||||
Host_Init (void)
|
||||
{
|
||||
byte *basepal, *colormap;
|
||||
|
||||
cl_cbuf = Cbuf_New (&id_interp);
|
||||
cl_stbuf = Cbuf_New (&id_interp);
|
||||
|
||||
|
@ -1727,41 +1777,21 @@ Host_Init (void)
|
|||
|
||||
pr_gametype = "quakeworld";
|
||||
|
||||
centerprint = dstring_newstr ();
|
||||
cls.userinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
||||
cls.servername = dstring_newstr ();
|
||||
cls.downloadtempname = dstring_newstr ();
|
||||
cls.downloadname = dstring_newstr ();
|
||||
cls.downloadurl = dstring_newstr ();
|
||||
cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
||||
|
||||
QFS_Init ("qw");
|
||||
QFS_GamedirCallback (CL_Autoexec);
|
||||
PI_Init ();
|
||||
|
||||
CL_Cam_Init_Cvars ();
|
||||
CL_Input_Init_Cvars ();
|
||||
CL_Init_Cvars ();
|
||||
CL_Prediction_Init_Cvars ();
|
||||
Game_Init_Cvars ();
|
||||
IN_Init_Cvars ();
|
||||
Key_Init_Cvars ();
|
||||
Mod_Init_Cvars ();
|
||||
Netchan_Init_Cvars ();
|
||||
|
||||
PR_Init_Cvars ();
|
||||
Pmove_Init_Cvars ();
|
||||
R_Init_Cvars ();
|
||||
S_Init_Cvars ();
|
||||
Team_Init_Cvars ();
|
||||
V_Init_Cvars ();
|
||||
VID_Init_Cvars ();
|
||||
|
||||
CL_Init_Cvars ();
|
||||
|
||||
PR_Init ();
|
||||
|
||||
CL_Chat_Init ();
|
||||
|
||||
CL_Cmd_Init ();
|
||||
V_Init ();
|
||||
Game_Init ();
|
||||
|
||||
PI_RegisterPlugins (client_plugin_list);
|
||||
|
@ -1788,36 +1818,9 @@ Host_Init (void)
|
|||
}
|
||||
CL_HTTP_Init ();
|
||||
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
Key_Init (cl_cbuf);
|
||||
Mod_Init ();
|
||||
|
||||
CL_Demo_Init ();
|
||||
|
||||
Sys_Printf ("%4.1f megabyte heap.\n", cl_mem_size->value);
|
||||
|
||||
basepal = (byte *) QFS_LoadHunkFile ("gfx/palette.lmp");
|
||||
if (!basepal)
|
||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||
colormap = (byte *) QFS_LoadHunkFile ("gfx/colormap.lmp");
|
||||
if (!colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
VID_Init (basepal, colormap);
|
||||
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 ();
|
||||
Locs_Init ();
|
||||
|
||||
CL_UpdateScreen (realtime);
|
||||
CL_UpdateScreen (realtime);
|
||||
|
|
Loading…
Reference in a new issue