From a9c9a46c375259228bc8ac4ab89a1ca9a037756e Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Mon, 21 May 2001 03:08:07 +0000 Subject: [PATCH] client.h gone from gl_rlight.c and sw_rlight.c. cl_lightstyle -> r_lightstyle --- include/QF/qdefs.h | 2 +- include/QF/render.h | 11 +++++++++++ nq/include/client.h | 7 ------- nq/source/cl_main.c | 3 +-- nq/source/cl_parse.c | 4 ++-- nq/source/gl_draw.c | 3 ++- nq/source/gl_rlight.c | 9 +++++---- nq/source/r_main.c | 4 ++++ nq/source/sw_rlight.c | 7 +++---- qw/include/client.h | 9 --------- qw/source/cl_demo.c | 2 +- qw/source/cl_main.c | 3 +-- qw/source/cl_parse.c | 4 ++-- qw/source/gl_draw.c | 3 ++- qw/source/gl_rlight.c | 9 +++++---- qw/source/r_main.c | 4 ++++ qw/source/sw_rlight.c | 7 +++---- 17 files changed, 47 insertions(+), 44 deletions(-) diff --git a/include/QF/qdefs.h b/include/QF/qdefs.h index de1de4a41..a15aaaa34 100644 --- a/include/QF/qdefs.h +++ b/include/QF/qdefs.h @@ -1,7 +1,7 @@ /* qdefs.h - (description) + ewww. this whole thing is a giant FIXME Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project diff --git a/include/QF/render.h b/include/QF/render.h index ee311ef73..c8cfd705c 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -32,11 +32,13 @@ #include "QF/cvar.h" #include "QF/mathlib.h" #include "QF/model.h" +#include "QF/qdefs.h" // FIXME #include "QF/vid.h" // dynamic lights =========================================================== #define MAX_DLIGHTS 32 + typedef struct dlight_s { int key; // so entities can reuse same entry @@ -48,8 +50,17 @@ typedef struct dlight_s float color[3]; // Don't use alpha --KB } dlight_t; +// FIXME client_state_t should hold all pieces of the client state +typedef struct +{ + int length; + char map[MAX_STYLESTRING]; +} lightstyle_t; + extern dlight_t r_dlights[MAX_DLIGHTS]; +extern lightstyle_t r_lightstyle[MAX_LIGHTSTYLES]; + //=============== #define TOP_RANGE 16 // soldier uniform colors diff --git a/nq/include/client.h b/nq/include/client.h index 4bc66872e..8ef0482e3 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -58,12 +58,6 @@ typedef struct usercmd_s #endif } usercmd_t; -typedef struct -{ - int length; - char map[MAX_STYLESTRING]; -} lightstyle_t; - typedef struct { char name[MAX_SCOREBOARDNAME]; @@ -281,7 +275,6 @@ extern client_state_t cl; // FIXME, allocate dynamically extern entity_t cl_entities[MAX_EDICTS]; extern entity_t cl_static_entities[MAX_STATIC_ENTITIES]; -extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; /* diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 3f0a968f8..e668617d8 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -88,7 +88,6 @@ entity_t cl_entities[MAX_EDICTS]; entity_state_t cl_baselines[MAX_EDICTS]; entity_t cl_static_entities[MAX_STATIC_ENTITIES]; entity_state_t cl_static_entity_baselines[MAX_STATIC_ENTITIES]; -lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; void @@ -169,7 +168,7 @@ CL_ClearState (void) // clear other arrays memset (cl_entities, 0, sizeof (cl_entities)); memset (cl_baselines, 0, sizeof (cl_baselines)); - memset (cl_lightstyle, 0, sizeof (cl_lightstyle)); + memset (r_lightstyle, 0, sizeof (r_lightstyle)); CL_ClearTEnts (); diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index c7d41bc7d..4529cad91 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -765,8 +765,8 @@ CL_ParseServerMessage (void) i = MSG_ReadByte (net_message); if (i >= MAX_LIGHTSTYLES) Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); - strcpy (cl_lightstyle[i].map, MSG_ReadString (net_message)); - cl_lightstyle[i].length = strlen (cl_lightstyle[i].map); + strcpy (r_lightstyle[i].map, MSG_ReadString (net_message)); + r_lightstyle[i].length = strlen (r_lightstyle[i].map); break; case svc_sound: diff --git a/nq/source/gl_draw.c b/nq/source/gl_draw.c index 96341dce7..cd5316228 100644 --- a/nq/source/gl_draw.c +++ b/nq/source/gl_draw.c @@ -41,6 +41,7 @@ #include "QF/cmd.h" #include "QF/console.h" #include "QF/draw.h" +#include "QF/quakefs.h" #include "QF/screen.h" #include "QF/sys.h" #include "QF/vid.h" @@ -134,7 +135,7 @@ Draw_CachePic (char *path, qboolean alpha) qpic_t *dat; glpic_t *gl; - // First, check and see if its cached.. + // First, check if its cached.. for (pic = cachepics, i = 0; i < numcachepics; pic++, i++) if ((!strcmp (path, pic->name)) && !pic->dirty) return &pic->pic; diff --git a/nq/source/gl_rlight.c b/nq/source/gl_rlight.c index c5e990dce..b2f68f77b 100644 --- a/nq/source/gl_rlight.c +++ b/nq/source/gl_rlight.c @@ -39,7 +39,8 @@ #include #include -#include "client.h" +#include "QF/render.h" + #include "glquake.h" #include "r_shared.h" @@ -53,12 +54,12 @@ R_AnimateLight (void) // 'm' is normal light, 'a' is no light, 'z' is double bright i = (int) (r_realtime * 10); for (j = 0; j < MAX_LIGHTSTYLES; j++) { - if (!cl_lightstyle[j].length) { + if (!r_lightstyle[j].length) { d_lightstylevalue[j] = 256; continue; } - k = i % cl_lightstyle[j].length; - k = cl_lightstyle[j].map[k] - 'a'; + k = i % r_lightstyle[j].length; + k = r_lightstyle[j].map[k] - 'a'; k = k * 22; d_lightstylevalue[j] = k; } diff --git a/nq/source/r_main.c b/nq/source/r_main.c index 0c23f11cc..17b057e64 100644 --- a/nq/source/r_main.c +++ b/nq/source/r_main.c @@ -10,6 +10,8 @@ double r_realtime; dlight_t r_dlights[MAX_DLIGHTS]; entity_t *r_view_model; entity_t *r_player_entity; +lightstyle_t r_lightstyle[MAX_LIGHTSTYLES]; + dlight_t * R_AllocDlight (int key) @@ -46,6 +48,7 @@ R_AllocDlight (int key) return dl; } + void R_DecayLights (double frametime) { @@ -63,6 +66,7 @@ R_DecayLights (double frametime) } } + void R_ClearDlights (void) { diff --git a/nq/source/sw_rlight.c b/nq/source/sw_rlight.c index 225c551b5..acdabe1e6 100644 --- a/nq/source/sw_rlight.c +++ b/nq/source/sw_rlight.c @@ -32,7 +32,6 @@ #include "QF/render.h" -#include "client.h" #include "r_local.h" int r_dlightframecount; @@ -47,12 +46,12 @@ R_AnimateLight (void) // 'm' is normal light, 'a' is no light, 'z' is double bright i = (int) (r_realtime * 10); for (j = 0; j < MAX_LIGHTSTYLES; j++) { - if (!cl_lightstyle[j].length) { + if (!r_lightstyle[j].length) { d_lightstylevalue[j] = 256; continue; } - k = i % cl_lightstyle[j].length; - k = cl_lightstyle[j].map[k] - 'a'; + k = i % r_lightstyle[j].length; + k = r_lightstyle[j].map[k] - 'a'; k = k * 22; d_lightstylevalue[j] = k; } diff --git a/qw/include/client.h b/qw/include/client.h index be33fe771..65710da26 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -114,14 +114,6 @@ typedef struct } frame_t; -// client_state_t should hold all pieces of the client state -typedef struct -{ - int length; - char map[MAX_STYLESTRING]; -} lightstyle_t; - - #define MAX_DEMOS 8 #define MAX_DEMONAME 16 @@ -317,7 +309,6 @@ extern client_state_t cl; // FIXME, allocate dynamically extern entity_state_t cl_baselines[MAX_EDICTS]; extern entity_t cl_static_entities[MAX_STATIC_ENTITIES]; -extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; extern qboolean nomaster; extern char *server_version; // version of server we connected to diff --git a/qw/source/cl_demo.c b/qw/source/cl_demo.c index e4b707673..40ff2d4c7 100644 --- a/qw/source/cl_demo.c +++ b/qw/source/cl_demo.c @@ -635,7 +635,7 @@ CL_Record_f (void) for (i = 0; i < MAX_LIGHTSTYLES; i++) { MSG_WriteByte (&buf, svc_lightstyle); MSG_WriteByte (&buf, (char) i); - MSG_WriteString (&buf, cl_lightstyle[i].map); + MSG_WriteString (&buf, r_lightstyle[i].map); } for (i = 0; i < MAX_CL_STATS; i++) { diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index b349e3da1..1bdbfe41a 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -165,7 +165,6 @@ client_state_t cl; entity_state_t cl_baselines[MAX_EDICTS]; efrag_t cl_efrags[MAX_EFRAGS]; entity_t cl_static_entities[MAX_STATIC_ENTITIES]; -lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; double connect_time = -1; // for connection retransmits @@ -420,7 +419,7 @@ CL_ClearState (void) // clear other arrays memset (cl_efrags, 0, sizeof (cl_efrags)); - memset (cl_lightstyle, 0, sizeof (cl_lightstyle)); + memset (r_lightstyle, 0, sizeof (r_lightstyle)); } diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index fba257fbb..47948915b 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -1209,8 +1209,8 @@ CL_ParseServerMessage (void) if (i >= MAX_LIGHTSTYLES) // Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); Host_EndGame ("svc_lightstyle > MAX_LIGHTSTYLES"); - strcpy (cl_lightstyle[i].map, MSG_ReadString (net_message)); - cl_lightstyle[i].length = strlen (cl_lightstyle[i].map); + strcpy (r_lightstyle[i].map, MSG_ReadString (net_message)); + r_lightstyle[i].length = strlen (r_lightstyle[i].map); break; case svc_sound: diff --git a/qw/source/gl_draw.c b/qw/source/gl_draw.c index 96341dce7..cd5316228 100644 --- a/qw/source/gl_draw.c +++ b/qw/source/gl_draw.c @@ -41,6 +41,7 @@ #include "QF/cmd.h" #include "QF/console.h" #include "QF/draw.h" +#include "QF/quakefs.h" #include "QF/screen.h" #include "QF/sys.h" #include "QF/vid.h" @@ -134,7 +135,7 @@ Draw_CachePic (char *path, qboolean alpha) qpic_t *dat; glpic_t *gl; - // First, check and see if its cached.. + // First, check if its cached.. for (pic = cachepics, i = 0; i < numcachepics; pic++, i++) if ((!strcmp (path, pic->name)) && !pic->dirty) return &pic->pic; diff --git a/qw/source/gl_rlight.c b/qw/source/gl_rlight.c index c5e990dce..b2f68f77b 100644 --- a/qw/source/gl_rlight.c +++ b/qw/source/gl_rlight.c @@ -39,7 +39,8 @@ #include #include -#include "client.h" +#include "QF/render.h" + #include "glquake.h" #include "r_shared.h" @@ -53,12 +54,12 @@ R_AnimateLight (void) // 'm' is normal light, 'a' is no light, 'z' is double bright i = (int) (r_realtime * 10); for (j = 0; j < MAX_LIGHTSTYLES; j++) { - if (!cl_lightstyle[j].length) { + if (!r_lightstyle[j].length) { d_lightstylevalue[j] = 256; continue; } - k = i % cl_lightstyle[j].length; - k = cl_lightstyle[j].map[k] - 'a'; + k = i % r_lightstyle[j].length; + k = r_lightstyle[j].map[k] - 'a'; k = k * 22; d_lightstylevalue[j] = k; } diff --git a/qw/source/r_main.c b/qw/source/r_main.c index 0c23f11cc..17b057e64 100644 --- a/qw/source/r_main.c +++ b/qw/source/r_main.c @@ -10,6 +10,8 @@ double r_realtime; dlight_t r_dlights[MAX_DLIGHTS]; entity_t *r_view_model; entity_t *r_player_entity; +lightstyle_t r_lightstyle[MAX_LIGHTSTYLES]; + dlight_t * R_AllocDlight (int key) @@ -46,6 +48,7 @@ R_AllocDlight (int key) return dl; } + void R_DecayLights (double frametime) { @@ -63,6 +66,7 @@ R_DecayLights (double frametime) } } + void R_ClearDlights (void) { diff --git a/qw/source/sw_rlight.c b/qw/source/sw_rlight.c index 225c551b5..acdabe1e6 100644 --- a/qw/source/sw_rlight.c +++ b/qw/source/sw_rlight.c @@ -32,7 +32,6 @@ #include "QF/render.h" -#include "client.h" #include "r_local.h" int r_dlightframecount; @@ -47,12 +46,12 @@ R_AnimateLight (void) // 'm' is normal light, 'a' is no light, 'z' is double bright i = (int) (r_realtime * 10); for (j = 0; j < MAX_LIGHTSTYLES; j++) { - if (!cl_lightstyle[j].length) { + if (!r_lightstyle[j].length) { d_lightstylevalue[j] = 256; continue; } - k = i % cl_lightstyle[j].length; - k = cl_lightstyle[j].map[k] - 'a'; + k = i % r_lightstyle[j].length; + k = r_lightstyle[j].map[k] - 'a'; k = k * 22; d_lightstylevalue[j] = k; }