From 4d9c3408a1d46a259b71a6461b7ed40a90904f5b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 23 Feb 2012 21:17:32 +0900 Subject: [PATCH] Start putting the pieces back together. The renderer now gets initialized and things sort of work (qw-client will idle, though nothing is displayed). However, as the viddef stuff is broken, it segs on trying to run the overkill demo. --- include/QF/plugin/vid_render.h | 1 - include/r_internal.h | 4 ++++ libs/video/renderer/gl/namehack.h | 1 - libs/video/renderer/glsl/namehack.h | 1 - libs/video/renderer/r_cvar.c | 3 +++ libs/video/renderer/r_init.c | 4 ++++ libs/video/renderer/sw32/namehack.h | 1 - libs/video/renderer/vid_common.c | 2 +- libs/video/renderer/vid_render_gl.c | 15 +++++++++++++++ libs/video/renderer/vid_render_glsl.c | 15 +++++++++++++++ libs/video/renderer/vid_render_sw.c | 15 +++++++++++++++ libs/video/renderer/vid_render_sw32.c | 15 +++++++++++++++ nq/source/cl_main.c | 2 -- nq/source/cl_view.c | 2 +- qw/source/cl_main.c | 3 +-- qw/source/cl_screen.c | 4 ++-- qw/source/cl_view.c | 2 +- 17 files changed, 77 insertions(+), 13 deletions(-) diff --git a/include/QF/plugin/vid_render.h b/include/QF/plugin/vid_render.h index 7eee222ce..dc86c70db 100644 --- a/include/QF/plugin/vid_render.h +++ b/include/QF/plugin/vid_render.h @@ -172,7 +172,6 @@ typedef struct vid_render_data_s { struct cvar_s *scr_viewsize; struct cvar_s *graphheight; float min_wateralpha; - qboolean active; qboolean force_fullscreen; qboolean inhibit_viewmodel; qboolean paused; diff --git a/include/r_internal.h b/include/r_internal.h index c6abf24d3..5c1817fa7 100644 --- a/include/r_internal.h +++ b/include/r_internal.h @@ -38,7 +38,11 @@ void Fog_StartAdditive (void); void Fog_StopAdditive (void); void Fog_Init (void); +void gl_R_Init (void); +void glsl_R_Init (void); void sw_R_Init (void); +void sw32_R_Init (void); + void R_Init_Cvars (void); void R_InitEfrags (void); void R_ClearState (void); diff --git a/libs/video/renderer/gl/namehack.h b/libs/video/renderer/gl/namehack.h index 7ba8050eb..075e31836 100644 --- a/libs/video/renderer/gl/namehack.h +++ b/libs/video/renderer/gl/namehack.h @@ -46,7 +46,6 @@ #define R_DrawSpriteModel gl_R_DrawSpriteModel #define R_DrawWaterSurfaces gl_R_DrawWaterSurfaces #define R_DrawWorld gl_R_DrawWorld -#define R_Init gl_R_Init #define R_InitBubble gl_R_InitBubble #define R_InitGraphTextures gl_R_InitGraphTextures #define R_InitParticles gl_R_InitParticles diff --git a/libs/video/renderer/glsl/namehack.h b/libs/video/renderer/glsl/namehack.h index fb88ba791..7edaed944 100644 --- a/libs/video/renderer/glsl/namehack.h +++ b/libs/video/renderer/glsl/namehack.h @@ -47,7 +47,6 @@ #define R_DrawSpriteModel glsl_R_DrawSpriteModel #define R_DrawWaterSurfaces glsl_R_DrawWaterSurfaces #define R_DrawWorld glsl_R_DrawWorld -#define R_Init glsl_R_Init #define R_InitBubble glsl_R_InitBubble #define R_InitGraphTextures glsl_R_InitGraphTextures #define R_InitParticles glsl_R_InitParticles diff --git a/libs/video/renderer/r_cvar.c b/libs/video/renderer/r_cvar.c index 72268cf67..e428c87ba 100644 --- a/libs/video/renderer/r_cvar.c +++ b/libs/video/renderer/r_cvar.c @@ -341,4 +341,7 @@ R_Init_Cvars (void) scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, viewsize_f, "Set the screen size 30 minimum, 120 maximum"); R_Particles_Init_Cvars (); + + vr_data.graphheight = r_graphheight; + vr_data.scr_viewsize = scr_viewsize; } diff --git a/libs/video/renderer/r_init.c b/libs/video/renderer/r_init.c index da68f1ee9..91640a9d5 100644 --- a/libs/video/renderer/r_init.c +++ b/libs/video/renderer/r_init.c @@ -45,6 +45,8 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #include "QF/render.h" #include "QF/sys.h" +#include "QF/plugin/general.h" + #include "r_internal.h" cvar_t *vidrend_plugin; @@ -76,4 +78,6 @@ R_Init (void) r_funcs = vidrendmodule->functions->vid_render; mod_funcs = r_funcs->model_funcs; r_data = vidrendmodule->data->vid_render; + + vidrendmodule->functions->general->p_Init (); } diff --git a/libs/video/renderer/sw32/namehack.h b/libs/video/renderer/sw32/namehack.h index 3a00e4cac..2f4e84461 100644 --- a/libs/video/renderer/sw32/namehack.h +++ b/libs/video/renderer/sw32/namehack.h @@ -73,7 +73,6 @@ #define R_DrawSurface sw32_R_DrawSurface #define R_EmitEdge sw32_R_EmitEdge #define R_GenerateSpans sw32_R_GenerateSpans -#define R_Init sw32_R_Init #define R_InitParticles sw32_R_InitParticles #define R_InitSky sw32_R_InitSky #define R_InitTurb sw32_R_InitTurb diff --git a/libs/video/renderer/vid_common.c b/libs/video/renderer/vid_common.c index 309a55f16..d7c83956c 100644 --- a/libs/video/renderer/vid_common.c +++ b/libs/video/renderer/vid_common.c @@ -40,7 +40,7 @@ vid_render_data_t vid_render_data = { 0, 0, 0, 0.0, - true, false, false, false, + false, false, false, 0, 0, 0, 0, diff --git a/libs/video/renderer/vid_render_gl.c b/libs/video/renderer/vid_render_gl.c index b38857645..6d3c72716 100644 --- a/libs/video/renderer/vid_render_gl.c +++ b/libs/video/renderer/vid_render_gl.c @@ -112,7 +112,22 @@ vid_render_funcs_t gl_vid_render_funcs = { &model_funcs }; +static void +gl_vid_render_init (void) +{ + m_funcs = &model_funcs; + R_Init_Cvars (); + gl_R_Init (); +} + +static void +gl_vid_render_shutdown (void) +{ +} + static general_funcs_t plugin_info_general_funcs = { + gl_vid_render_init, + gl_vid_render_shutdown, }; static general_data_t plugin_info_general_data; diff --git a/libs/video/renderer/vid_render_glsl.c b/libs/video/renderer/vid_render_glsl.c index f78a45b07..367d8f309 100644 --- a/libs/video/renderer/vid_render_glsl.c +++ b/libs/video/renderer/vid_render_glsl.c @@ -112,7 +112,22 @@ vid_render_funcs_t glsl_vid_render_funcs = { &model_funcs }; +static void +glsl_vid_render_init (void) +{ + m_funcs = &model_funcs; + R_Init_Cvars (); + glsl_R_Init (); +} + +static void +glsl_vid_render_shutdown (void) +{ +} + static general_funcs_t plugin_info_general_funcs = { + glsl_vid_render_init, + glsl_vid_render_shutdown, }; static general_data_t plugin_info_general_data; diff --git a/libs/video/renderer/vid_render_sw.c b/libs/video/renderer/vid_render_sw.c index deeed2834..cc7cd1337 100644 --- a/libs/video/renderer/vid_render_sw.c +++ b/libs/video/renderer/vid_render_sw.c @@ -107,7 +107,22 @@ vid_render_funcs_t sw_vid_render_funcs = { &model_funcs }; +static void +sw_vid_render_init (void) +{ + m_funcs = &model_funcs; + R_Init_Cvars (); + sw_R_Init (); +} + +static void +sw_vid_render_shutdown (void) +{ +} + static general_funcs_t plugin_info_general_funcs = { + sw_vid_render_init, + sw_vid_render_shutdown, }; static general_data_t plugin_info_general_data; diff --git a/libs/video/renderer/vid_render_sw32.c b/libs/video/renderer/vid_render_sw32.c index 1c74aa09e..508f43c99 100644 --- a/libs/video/renderer/vid_render_sw32.c +++ b/libs/video/renderer/vid_render_sw32.c @@ -112,7 +112,22 @@ vid_render_funcs_t sw32_vid_render_funcs = { &model_funcs }; +static void +sw32_vid_render_init (void) +{ + m_funcs = &model_funcs; + R_Init_Cvars (); + sw32_R_Init (); +} + +static void +sw32_vid_render_shutdown (void) +{ +} + static general_funcs_t plugin_info_general_funcs = { + sw32_vid_render_init, + sw32_vid_render_shutdown, }; static general_data_t plugin_info_general_data; diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 68a31a57a..fdf99f4c1 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -473,13 +473,11 @@ CL_SetState (cactive_t state) if (old_state != state) { if (state == ca_active) { // entering active state - r_data->active = true; Key_SetKeyDest (key_game); IN_ClearStates (); VID_SetCaption (""); } else if (old_state == ca_active) { // leaving active state - r_data->active = false; Key_SetKeyDest (key_console); VID_SetCaption ("Disconnected"); } diff --git a/nq/source/cl_view.c b/nq/source/cl_view.c index 55ffb4e67..0de5349c4 100644 --- a/nq/source/cl_view.c +++ b/nq/source/cl_view.c @@ -705,7 +705,7 @@ V_CalcRefdef (void) void V_RenderView (void) { - if (cls.signon != SIGNONS) + if (cls.state != ca_active) return; // don't allow cheats in multiplayer diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 2bca3657d..8b76ace4a 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1143,7 +1143,6 @@ CL_SetState (cactive_t state) if (old_state == ca_active) { // leaving active state IN_ClearStates (); - r_data->active = false; Key_SetKeyDest (key_console); // Auto demo recorder stops here @@ -1153,7 +1152,6 @@ CL_SetState (cactive_t state) // entering active state VID_SetCaption (cls.servername->str); IN_ClearStates (); - r_data->active = true; Key_SetKeyDest (key_game); // Auto demo recorder starts here @@ -1183,6 +1181,7 @@ CL_Init (void) IN_Init (cl_cbuf); Mod_Init (); R_Init (); + r_data->lightstyle = cl.lightstyle; PI_RegisterPlugins (client_plugin_list); Con_Init ("client"); diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index 32434dfde..a96514401 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -76,7 +76,7 @@ SCR_CShift (void) mleaf_t *leaf; int contents = CONTENTS_EMPTY; - if (r_data->active && cl.worldmodel) { + if (cls.state == ca_active && cl.worldmodel) { leaf = Mod_PointInLeaf (r_data->refdef->vieworg, cl.worldmodel); contents = leaf->contents; } @@ -125,7 +125,7 @@ CL_UpdateScreen (double realtime) index = 0; // don't allow cheats in multiplayer - if (r_data->active) { + if (cls.state == ca_active) { if (cl.watervis) r_data->min_wateralpha = 0.0; else diff --git a/qw/source/cl_view.c b/qw/source/cl_view.c index c5b2eb746..c99d48f2e 100644 --- a/qw/source/cl_view.c +++ b/qw/source/cl_view.c @@ -715,7 +715,7 @@ V_RenderView (void) { cl.simangles[ROLL] = 0; // FIXME @@@ - if (!r_data->active) + if (cls.state != ca_active) return; view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];