mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 04:21:51 +00:00
[client] Merge cl_screen.c
The client state that was accessed by cl_screen is now put in viewstate and maintained by the client before calling CL_UpdateScreen.
This commit is contained in:
parent
9f01cb25fe
commit
4491ce213b
23 changed files with 92 additions and 346 deletions
10
include/client/screen.h
Normal file
10
include/client/screen.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef __client_screen_h
|
||||
#define __client_screen_h
|
||||
|
||||
extern struct view_s cl_screen_view;
|
||||
|
||||
struct viewstate_s;
|
||||
void CL_Init_Screen (void);
|
||||
void CL_UpdateScreen (struct viewstate_s *vs);
|
||||
|
||||
#endif//__client_screen_h
|
|
@ -60,11 +60,15 @@ typedef struct viewstate_s {
|
|||
vec4f_t punchangle;
|
||||
transform_t camera_transform;
|
||||
double time;
|
||||
double last_servermessage;
|
||||
float frametime;
|
||||
float height;
|
||||
int weaponframe;
|
||||
int onground; // -1 when in air
|
||||
int active:1;
|
||||
int loading:1;
|
||||
int watervis:1;
|
||||
int demoplayback:1;
|
||||
int drift_enabled:1;
|
||||
int voffs_enabled:1;
|
||||
int bob_enabled:1;
|
||||
|
|
|
@ -9,6 +9,7 @@ libs_client_libQFclient_la_SOURCES= \
|
|||
libs/client/cl_input.c \
|
||||
libs/client/cl_light.c \
|
||||
libs/client/cl_particles.c \
|
||||
libs/client/cl_screen.c \
|
||||
libs/client/cl_temp_entities.c \
|
||||
libs/client/cl_view.c \
|
||||
libs/client/cl_world.c \
|
||||
|
|
|
@ -56,9 +56,11 @@
|
|||
#include "r_local.h" //FIXME for r_cache_thrash
|
||||
|
||||
#include "client/hud.h"
|
||||
#include "client/screen.h"
|
||||
#include "client/view.h"
|
||||
#include "client/world.h"
|
||||
|
||||
#include "nq/include/client.h"
|
||||
//#include "nq/include/client.h"
|
||||
|
||||
int scr_showpause;
|
||||
static cvar_t scr_showpause_cvar = {
|
||||
|
@ -97,20 +99,22 @@ static view_t ram_view;
|
|||
static view_t turtle_view;
|
||||
static view_t pause_view;
|
||||
|
||||
static viewstate_t *_vs;//FIXME ick
|
||||
|
||||
static void
|
||||
SCR_CShift (void)
|
||||
{
|
||||
mleaf_t *leaf;
|
||||
int contents = CONTENTS_EMPTY;
|
||||
|
||||
if (cls.state == ca_active && cl_world.scene->worldmodel) {
|
||||
if (_vs->active && cl_world.scene->worldmodel) {
|
||||
vec4f_t origin;
|
||||
origin = Transform_GetWorldPosition (cl.viewstate.camera_transform);
|
||||
origin = Transform_GetWorldPosition (_vs->camera_transform);
|
||||
leaf = Mod_PointInLeaf (origin, cl_world.scene->worldmodel);
|
||||
contents = leaf->contents;
|
||||
}
|
||||
V_SetContentsColor (&cl.viewstate, contents);
|
||||
r_funcs->Draw_BlendScreen (cl.viewstate.cshift_color);
|
||||
V_SetContentsColor (_vs, contents);
|
||||
r_funcs->Draw_BlendScreen (_vs->cshift_color);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -130,9 +134,9 @@ scr_draw_views (void)
|
|||
View_SetVisible (pause_view, scr_showpause && r_data->paused);
|
||||
|
||||
View_SetVisible (ram_view, scr_showram && r_cache_thrash);
|
||||
View_SetVisible (net_view, (!cls.demoplayback
|
||||
&& realtime - cl.last_servermessage >= 0.3));
|
||||
View_SetVisible (loading_view, cl.loading);
|
||||
View_SetVisible (net_view, (!_vs->demoplayback
|
||||
&& _vs->time - _vs->last_servermessage >= 0.3));
|
||||
View_SetVisible (loading_view, _vs->loading);
|
||||
// FIXME cvar callbacks
|
||||
View_SetVisible (timegraph_view, r_timegraph);
|
||||
View_SetVisible (zgraph_view, r_zgraph);
|
||||
|
@ -256,25 +260,24 @@ CL_Init_Screen (void)
|
|||
}
|
||||
|
||||
void
|
||||
CL_UpdateScreen (double realtime)
|
||||
CL_UpdateScreen (viewstate_t *vs)
|
||||
{
|
||||
unsigned index = cl.intermission;
|
||||
unsigned index = vs->intermission;
|
||||
_vs = vs;
|
||||
|
||||
if (index >= sizeof (scr_funcs) / sizeof (scr_funcs[0]))
|
||||
index = 0;
|
||||
|
||||
//FIXME not every time
|
||||
if (cls.state == ca_active) {
|
||||
if (cl.watervis)
|
||||
if (vs->active) {
|
||||
if (vs->watervis)
|
||||
r_data->min_wateralpha = 0.0;
|
||||
else
|
||||
r_data->min_wateralpha = 1.0;
|
||||
}
|
||||
scr_funcs_normal[0] = r_funcs->Draw_Crosshair;
|
||||
|
||||
cl.viewstate.intermission = cl.intermission != 0;
|
||||
V_PrepBlend (&cl.viewstate);
|
||||
V_RenderView (&cl.viewstate);
|
||||
SCR_UpdateScreen (cl.viewstate.camera_transform,
|
||||
realtime, scr_funcs[index]);
|
||||
V_PrepBlend (vs);
|
||||
V_RenderView (vs);
|
||||
SCR_UpdateScreen (vs->camera_transform, vs->time, scr_funcs[index]);
|
||||
}
|
|
@ -48,6 +48,7 @@
|
|||
#include "netmain.h"
|
||||
|
||||
//FIXME these should not be here!!!
|
||||
#include "client/screen.h"
|
||||
#include "../nq/include/client.h"
|
||||
#include "../nq/include/server.h"
|
||||
|
||||
|
@ -1020,7 +1021,8 @@ _Datagram_Connect (const char *host)
|
|||
|
||||
// send the connection request
|
||||
Sys_Printf ("trying...\n");
|
||||
CL_UpdateScreen (cl.time);
|
||||
cl.viewstate.time = cl.time;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
start_time = net_time;
|
||||
|
||||
for (reps = 0; reps < 3; reps++) {
|
||||
|
@ -1081,7 +1083,8 @@ _Datagram_Connect (const char *host)
|
|||
break;
|
||||
}
|
||||
Sys_Printf ("still trying...\n");
|
||||
CL_UpdateScreen (cl.time);
|
||||
cl.viewstate.time = cl.time;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
start_time = SetNetTime ();
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,6 @@ extern client_static_t cls;
|
|||
the client_state_t structure is wiped completely at every server signon
|
||||
*/
|
||||
typedef struct client_state_s {
|
||||
qboolean loading;
|
||||
|
||||
int movemessages; // Since connecting to this server throw out
|
||||
// the first couple, so the player doesn't
|
||||
// accidentally do something the first frame
|
||||
|
@ -167,7 +165,6 @@ typedef struct client_state_s {
|
|||
// to decay light values and smooth step ups
|
||||
|
||||
double last_ping_request; // while showing scoreboard
|
||||
double last_servermessage; // (realtime) for net trouble icon
|
||||
|
||||
/* information that is static for the entire time connected to a server */
|
||||
|
||||
|
@ -186,7 +183,6 @@ typedef struct client_state_s {
|
|||
int sv_cshifts;
|
||||
int no_pogo_stick;
|
||||
int teamplay;
|
||||
int watervis;
|
||||
int fpd;
|
||||
int fbskins;
|
||||
|
||||
|
@ -289,10 +285,6 @@ extern qboolean recording;
|
|||
struct cvar_s;
|
||||
void Cvar_Info (void *data, const struct cvar_s *cvar);
|
||||
|
||||
extern struct view_s cl_screen_view;
|
||||
void CL_Init_Screen (void);
|
||||
void CL_UpdateScreen (double realtime);
|
||||
|
||||
void CL_SetState (cactive_t state);
|
||||
|
||||
void CL_Cmd_ForwardToServer (void);
|
||||
|
|
|
@ -73,7 +73,7 @@ nq_server_LIB_DEPS=$(nq_server_LIBFILES) $(nq_common_LIBFILES)
|
|||
|
||||
nq_source_libnq_client_a_SOURCES= \
|
||||
nq/source/cl_cmd.c nq/source/cl_demo.c nq/source/cl_ents.c nq/source/cl_input.c nq/source/cl_main.c \
|
||||
nq/source/cl_screen.c nq/source/cl_parse.c nq/source/sbar.c
|
||||
nq/source/cl_parse.c nq/source/sbar.c
|
||||
|
||||
nq_source_libnq_server_a_SOURCES= \
|
||||
nq/source/host.c nq/source/host_cmd.c nq/source/sv_cl_phys.c nq/source/sv_cvar.c nq/source/sv_main.c \
|
||||
|
|
|
@ -167,6 +167,7 @@ CL_StopPlayback (void)
|
|||
CL_SetState (ca_disconnected);
|
||||
cls.demo_capture = 0;
|
||||
cls.demoplayback = 0;
|
||||
cl.viewstate.demoplayback = 0;
|
||||
|
||||
if (cls.timedemo)
|
||||
CL_FinishTimeDemo ();
|
||||
|
@ -515,6 +516,7 @@ CL_StartDemo (void)
|
|||
}
|
||||
|
||||
cls.demoplayback = true;
|
||||
cl.viewstate.demoplayback = 1;
|
||||
CL_SetState (ca_connected);
|
||||
cls.forcetrack = 0;
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
#include "client/chase.h"
|
||||
#include "client/particles.h"
|
||||
#include "client/screen.h"
|
||||
#include "client/temp_entities.h"
|
||||
#include "client/world.h"
|
||||
|
||||
|
@ -297,7 +298,7 @@ CL_ClearState (void)
|
|||
cl.viewstate.chase = 1;
|
||||
cl.viewstate.chasestate = &cl.chasestate;
|
||||
cl.chasestate.viewstate = &cl.viewstate;
|
||||
cl.watervis = 1;
|
||||
cl.viewstate.watervis = 1;
|
||||
SCR_SetFullscreen (0);
|
||||
r_data->lightstyle = cl.lightstyle;
|
||||
|
||||
|
@ -434,7 +435,7 @@ CL_SignonReply (void)
|
|||
break;
|
||||
|
||||
case so_active:
|
||||
cl.loading = false;
|
||||
cl.viewstate.loading = false;
|
||||
CL_SetState (ca_active);
|
||||
break;
|
||||
}
|
||||
|
@ -451,8 +452,9 @@ CL_NextDemo (void)
|
|||
if (cls.demonum == -1)
|
||||
return; // don't play demos
|
||||
|
||||
cl.loading = true;
|
||||
CL_UpdateScreen(cl.time);
|
||||
cl.viewstate.loading = true;
|
||||
cl.viewstate.time = cl.time;
|
||||
CL_UpdateScreen(&cl.viewstate);
|
||||
|
||||
if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) {
|
||||
cls.demonum = 0;
|
||||
|
@ -589,25 +591,25 @@ CL_SetState (cactive_t state)
|
|||
case ca_disconnected:
|
||||
CL_ClearState ();
|
||||
cls.signon = so_none;
|
||||
cl.loading = false;
|
||||
cl.viewstate.loading = false;
|
||||
VID_SetCaption ("Disconnected");
|
||||
break;
|
||||
case ca_connected:
|
||||
cls.signon = so_none; // need all the signon messages
|
||||
// before playing
|
||||
cl.loading = true;
|
||||
cl.viewstate.loading = true;
|
||||
IN_ClearStates ();
|
||||
VID_SetCaption ("Connected");
|
||||
break;
|
||||
case ca_active:
|
||||
// entering active state
|
||||
cl.loading = false;
|
||||
cl.viewstate.loading = false;
|
||||
IN_ClearStates ();
|
||||
VID_SetCaption ("");
|
||||
S_AmbientOn ();
|
||||
break;
|
||||
}
|
||||
CL_UpdateScreen (cl.time);
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
}
|
||||
host_in_game = 0;
|
||||
Con_SetState (state == ca_active ? con_inactive : con_fullscreen);
|
||||
|
@ -660,7 +662,8 @@ CL_Frame (void)
|
|||
|| cl.stats[STAT_HEALTH] <= 0);
|
||||
r_data->frametime = host_frametime;
|
||||
|
||||
CL_UpdateScreen (cl.time);
|
||||
cl.viewstate.intermission = cl.intermission != 0;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
|
||||
if (host_speeds)
|
||||
time2 = Sys_DoubleTime ();
|
||||
|
|
|
@ -722,7 +722,7 @@ CL_ParseServerMessage (void)
|
|||
static dstring_t *stuffbuf;
|
||||
signon_t so;
|
||||
|
||||
cl.last_servermessage = realtime;
|
||||
cl.viewstate.last_servermessage = realtime;
|
||||
TEntContext_t tentCtx = {
|
||||
cl.viewstate.player_origin,
|
||||
cl.viewentity
|
||||
|
|
|
@ -309,7 +309,7 @@ Host_Error (const char *error, ...)
|
|||
|
||||
inerror = true;
|
||||
|
||||
cl.loading = false;
|
||||
cl.viewstate.loading = false;
|
||||
|
||||
va_start (argptr, error);
|
||||
dvsprintf (str, error, argptr);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "client/screen.h"
|
||||
#include "client/world.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
@ -294,8 +295,9 @@ Host_Map_f (void)
|
|||
CL_Disconnect ();
|
||||
Host_ShutdownServer (false);
|
||||
|
||||
cl.loading = true;
|
||||
CL_UpdateScreen (cl.time);
|
||||
cl.viewstate.loading = true;
|
||||
cl.viewstate.time = cl.time;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
|
||||
svs.serverflags = 0; // haven't completed an episode yet
|
||||
strcpy (name, Cmd_Argv (1));
|
||||
|
@ -624,8 +626,9 @@ Host_Loadgame_f (void)
|
|||
dsprintf (name, "%s/%s", qfs_gamedir->dir.def, Cmd_Argv (1));
|
||||
QFS_DefaultExtension (name, ".sav");
|
||||
|
||||
cl.loading = true;
|
||||
CL_UpdateScreen (cl.time);
|
||||
cl.viewstate.loading = true;
|
||||
cl.viewstate.time = cl.time;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
|
||||
Sys_Printf ("Loading game from %s...\n", name->str);
|
||||
f = QFS_Open (name->str, "rz");
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "sbar.h"
|
||||
|
||||
#include "client/hud.h"
|
||||
#include "client/screen.h"
|
||||
|
||||
#include "nq/include/client.h"
|
||||
#include "nq/include/game.h"
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "client/world.h"
|
||||
|
||||
#include "client/screen.h"
|
||||
#include "nq/include/client.h"
|
||||
#include "nq/include/host.h"
|
||||
#include "nq/include/server.h"
|
||||
|
@ -78,7 +79,7 @@ CL_SetState (cactive_t state)
|
|||
}
|
||||
|
||||
void
|
||||
CL_UpdateScreen (double realtime)
|
||||
CL_UpdateScreen (struct viewstate_s *)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -176,8 +176,6 @@ extern client_static_t cls;
|
|||
the client_state_t structure is wiped completely at every server signon
|
||||
*/
|
||||
typedef struct client_state_s {
|
||||
qboolean loading;
|
||||
|
||||
int movemessages; // Since connecting to this server throw out
|
||||
// the first couple, so the player doesn't
|
||||
// accidentally do something the first frame
|
||||
|
@ -215,7 +213,6 @@ typedef struct client_state_s {
|
|||
// can't render a frame yet
|
||||
|
||||
double last_ping_request; // while showing scoreboard
|
||||
double last_servermessage; // (realtime) for net trouble icon
|
||||
|
||||
/* information that is static for the entire time connected to a server */
|
||||
|
||||
|
@ -238,7 +235,6 @@ typedef struct client_state_s {
|
|||
int sv_cshifts;
|
||||
int no_pogo_stick;
|
||||
int teamplay;
|
||||
int watervis;
|
||||
int fpd;
|
||||
int fbskins;
|
||||
|
||||
|
@ -300,10 +296,6 @@ void Cvar_Info (void *data, const struct cvar_s *cvar);
|
|||
void CL_NetGraph_Init (void);
|
||||
void CL_NetGraph_Init_Cvars (void);
|
||||
|
||||
extern struct view_s cl_screen_view;
|
||||
void CL_Init_Screen (void);
|
||||
void CL_UpdateScreen (double realtime);
|
||||
|
||||
void CL_SetState (cactive_t state);
|
||||
|
||||
void CL_Cmd_ForwardToServer (void);
|
||||
|
|
|
@ -106,7 +106,7 @@ qw_client_libs= qw/source/libqw_client.a qw/source/libqw_common.a \
|
|||
qw_source_libqw_client_a_SOURCES= \
|
||||
qw/source/cl_cam.c qw/source/cl_chat.c qw/source/cl_cmd.c qw/source/cl_cvar.c qw/source/cl_demo.c \
|
||||
qw/source/cl_entparse.c qw/source/cl_ents.c qw/source/cl_http.c qw/source/cl_input.c qw/source/cl_main.c qw/source/cl_ngraph.c \
|
||||
qw/source/cl_parse.c qw/source/cl_pred.c qw/source/cl_rss.c qw/source/cl_screen.c qw/source/cl_skin.c qw/source/cl_slist.c \
|
||||
qw/source/cl_parse.c qw/source/cl_pred.c qw/source/cl_rss.c qw/source/cl_skin.c qw/source/cl_slist.c \
|
||||
qw/source/sbar.c qw/source/teamplay.c
|
||||
|
||||
# Software-rendering clients
|
||||
|
|
|
@ -187,6 +187,7 @@ CL_StopPlayback (void)
|
|||
cls.demo_capture = 0;
|
||||
cls.demoplayback = 0;
|
||||
cls.demoplayback2 = 0;
|
||||
cl.viewstate.demoplayback = 0;
|
||||
demotime_cached = 0;
|
||||
net_blocksend = 0;
|
||||
|
||||
|
@ -1052,6 +1053,7 @@ CL_StartDemo (void)
|
|||
Sys_Printf ("Playing demo from %s.\n", name->str);
|
||||
|
||||
cls.demoplayback = true;
|
||||
cl.viewstate.demoplayback = 1;
|
||||
net_blocksend = 1;
|
||||
if (type == 2) {
|
||||
cls.demoplayback2 = true;
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
#include "sbar.h"
|
||||
|
||||
#include "client/particles.h"
|
||||
#include "client/screen.h"
|
||||
#include "client/temp_entities.h"
|
||||
#include "client/view.h"
|
||||
#include "client/world.h"
|
||||
|
@ -909,7 +910,7 @@ CL_FullServerinfo_f (void)
|
|||
Sbar_DMO_Init_f (0, 0); // HUD setup, cl.teamplay changed
|
||||
}
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "watervis")) && *p) {
|
||||
cl.watervis = atoi (p);
|
||||
cl.viewstate.watervis = atoi (p);
|
||||
}
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "fpd")) && *p) {
|
||||
cl.fpd = atoi (p);
|
||||
|
@ -1985,7 +1986,8 @@ Host_Frame (float time)
|
|||
|| cl.stats[STAT_HEALTH] <= 0);
|
||||
r_data->frametime = host_frametime;
|
||||
|
||||
CL_UpdateScreen (realtime);
|
||||
cl.viewstate.time = realtime;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
|
||||
if (host_speeds)
|
||||
time2 = Sys_DoubleTime ();
|
||||
|
@ -2126,8 +2128,9 @@ Host_Init (void)
|
|||
|
||||
CL_Init ();
|
||||
|
||||
CL_UpdateScreen (realtime);
|
||||
CL_UpdateScreen (realtime);
|
||||
cl.viewstate.time = realtime;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
|
||||
Host_ExecConfig (cl_cbuf, !cl_quakerc);
|
||||
|
||||
|
@ -2144,10 +2147,10 @@ Host_Init (void)
|
|||
|
||||
host_initialized = true;
|
||||
|
||||
CL_UpdateScreen (realtime);
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
Con_NewMap (); // force the menus to be loaded
|
||||
CL_UpdateScreen (realtime);
|
||||
CL_UpdateScreen (realtime);
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
|
||||
if (connect_time == -1) {
|
||||
Cbuf_AddText (cl_cbuf, "echo Type connect <internet address> or use a "
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "QF/ui/view.h"
|
||||
|
||||
#include "client/hud.h"
|
||||
#include "client/screen.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
|
||||
#include "client/effects.h"
|
||||
#include "client/particles.h"
|
||||
#include "client/screen.h"
|
||||
#include "client/temp_entities.h"
|
||||
#include "client/view.h"
|
||||
#include "client/world.h"
|
||||
|
@ -284,7 +285,8 @@ Model_NextDownload (void)
|
|||
|
||||
if (cls.downloadnumber == 0) {
|
||||
Sys_Printf ("Checking models...\n");
|
||||
CL_UpdateScreen (realtime);
|
||||
cl.viewstate.time = realtime;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
cls.downloadnumber = 1;
|
||||
}
|
||||
|
||||
|
@ -373,7 +375,8 @@ Sound_NextDownload (void)
|
|||
|
||||
if (cls.downloadnumber == 0) {
|
||||
Sys_Printf ("Checking sounds...\n");
|
||||
CL_UpdateScreen (realtime);
|
||||
cl.viewstate.time = realtime;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
cls.downloadnumber = 1;
|
||||
}
|
||||
|
||||
|
@ -1121,7 +1124,7 @@ CL_ServerInfo (void)
|
|||
cl.teamplay = atoi (value);
|
||||
Sbar_DMO_Init_f (0, 0); // HUD setup, cl.teamplay changed
|
||||
} else if (strequal (key, "watervis")) {
|
||||
cl.watervis = atoi (value);
|
||||
cl.viewstate.watervis = atoi (value);
|
||||
} else if (strequal (key, "fpd")) {
|
||||
cl.fpd = atoi (value);
|
||||
} else if (strequal (key, "fbskins")) {
|
||||
|
@ -1219,7 +1222,7 @@ CL_ParseServerMessage (void)
|
|||
};
|
||||
|
||||
received_framecount = host_framecount;
|
||||
cl.last_servermessage = realtime;
|
||||
cl.viewstate.last_servermessage = realtime;
|
||||
CL_ClearProjectiles ();
|
||||
|
||||
// if recording demos, copy the message out
|
||||
|
|
|
@ -1,281 +0,0 @@
|
|||
/*
|
||||
cl_screen.c
|
||||
|
||||
master for refresh, status bar, console, chat, notify, etc
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
#include "QF/image.h"
|
||||
#include "QF/pcx.h"
|
||||
#include "QF/screen.h"
|
||||
|
||||
#include "QF/plugin/console.h"
|
||||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
#include "QF/scene/scene.h"
|
||||
#include "QF/scene/transform.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
#include "sbar.h"
|
||||
|
||||
#include "r_local.h" //FIXME for r_cache_thrash
|
||||
|
||||
#include "client/hud.h"
|
||||
#include "client/world.h"
|
||||
|
||||
#include "qw/include/client.h"
|
||||
#include "qw/include/cl_parse.h"
|
||||
|
||||
int scr_showpause;
|
||||
static cvar_t scr_showpause_cvar = {
|
||||
.name = "showpause",
|
||||
.description =
|
||||
"Toggles display of pause graphic",
|
||||
.default_value = "1",
|
||||
.flags = CVAR_NONE,
|
||||
.value = { .type = &cexpr_int, .value = &scr_showpause },
|
||||
};
|
||||
int scr_showram;
|
||||
static cvar_t scr_showram_cvar = {
|
||||
.name = "showram",
|
||||
.description =
|
||||
"Show RAM icon if game is running low on memory",
|
||||
.default_value = "1",
|
||||
.flags = CVAR_NONE,
|
||||
.value = { .type = &cexpr_int, .value = &scr_showram },
|
||||
};
|
||||
int scr_showturtle;
|
||||
static cvar_t scr_showturtle_cvar = {
|
||||
.name = "showturtle",
|
||||
.description =
|
||||
"Show a turtle icon if your fps is below 10",
|
||||
.default_value = "0",
|
||||
.flags = CVAR_NONE,
|
||||
.value = { .type = &cexpr_int, .value = &scr_showturtle },
|
||||
};
|
||||
|
||||
view_t cl_screen_view;
|
||||
static view_t net_view;
|
||||
static view_t timegraph_view;
|
||||
static view_t zgraph_view;
|
||||
static view_t loading_view;
|
||||
static view_t ram_view;
|
||||
static view_t turtle_view;
|
||||
static view_t pause_view;
|
||||
|
||||
static void
|
||||
SCR_CShift (void)
|
||||
{
|
||||
mleaf_t *leaf;
|
||||
int contents = CONTENTS_EMPTY;
|
||||
|
||||
if (cls.state == ca_active && cl_world.scene->worldmodel) {
|
||||
vec4f_t origin;
|
||||
origin = Transform_GetWorldPosition (cl.viewstate.camera_transform);
|
||||
leaf = Mod_PointInLeaf (origin, cl_world.scene->worldmodel);
|
||||
contents = leaf->contents;
|
||||
}
|
||||
V_SetContentsColor (&cl.viewstate, contents);
|
||||
r_funcs->Draw_BlendScreen (cl.viewstate.cshift_color);
|
||||
}
|
||||
|
||||
static void
|
||||
scr_draw_views (void)
|
||||
{
|
||||
if (scr_showturtle) {
|
||||
static int count;
|
||||
if (r_data->frametime < 0.1) {
|
||||
count = 0;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
View_SetVisible (turtle_view, count > 2);
|
||||
}
|
||||
|
||||
// turn off for screenshots
|
||||
View_SetVisible (pause_view, scr_showpause && r_data->paused);
|
||||
|
||||
View_SetVisible (ram_view, scr_showram && r_cache_thrash);
|
||||
View_SetVisible (net_view, (!cls.demoplayback
|
||||
&& realtime - cl.last_servermessage >= 0.3));
|
||||
View_SetVisible (loading_view, cl.loading);
|
||||
// FIXME cvar callbacks
|
||||
View_SetVisible (timegraph_view, r_timegraph);
|
||||
View_SetVisible (zgraph_view, r_zgraph);
|
||||
}
|
||||
|
||||
static SCR_Func scr_funcs_normal[] = {
|
||||
0, //Draw_Crosshair,
|
||||
Sbar_Draw,
|
||||
HUD_Draw_Views,
|
||||
SCR_CShift,
|
||||
Sbar_DrawCenterPrint,
|
||||
scr_draw_views,
|
||||
Con_DrawConsole,
|
||||
0
|
||||
};
|
||||
|
||||
static SCR_Func scr_funcs_intermission[] = {
|
||||
Sbar_IntermissionOverlay,
|
||||
Con_DrawConsole,
|
||||
scr_draw_views,
|
||||
0
|
||||
};
|
||||
|
||||
static SCR_Func scr_funcs_finale[] = {
|
||||
Sbar_FinaleOverlay,
|
||||
Con_DrawConsole,
|
||||
scr_draw_views,
|
||||
0,
|
||||
};
|
||||
|
||||
static SCR_Func *scr_funcs[] = {
|
||||
scr_funcs_normal,
|
||||
scr_funcs_intermission,
|
||||
scr_funcs_finale,
|
||||
};
|
||||
|
||||
static void
|
||||
cl_vidsize_listener (void *data, const viddef_t *vdef)
|
||||
{
|
||||
View_SetLen (cl_screen_view, vdef->width, vdef->height);
|
||||
View_UpdateHierarchy (cl_screen_view);
|
||||
}
|
||||
|
||||
void
|
||||
CL_Init_Screen (void)
|
||||
{
|
||||
qpic_t *pic;
|
||||
|
||||
VID_OnVidResize_AddListener (cl_vidsize_listener, 0);
|
||||
|
||||
HUD_Init ();
|
||||
|
||||
cl_screen_view = View_New (hud_registry, nullview);
|
||||
con_module->data->console->screen_view = &cl_screen_view;
|
||||
|
||||
View_SetPos (cl_screen_view, 0, 0);
|
||||
View_SetLen (cl_screen_view, viddef.width, viddef.height);
|
||||
View_SetGravity (cl_screen_view, grav_northwest);
|
||||
View_SetVisible (cl_screen_view, 1);
|
||||
|
||||
pic = r_funcs->Draw_PicFromWad ("ram");
|
||||
ram_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (ram_view, 32, 0);
|
||||
View_SetLen (ram_view, pic->width, pic->height);
|
||||
View_SetGravity (ram_view, grav_northwest);
|
||||
Ent_SetComponent (ram_view.id, hud_pic, ram_view.reg, &pic);
|
||||
View_SetVisible (ram_view, 0);
|
||||
|
||||
pic = r_funcs->Draw_PicFromWad ("turtle");
|
||||
turtle_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (turtle_view, 32, 0);
|
||||
View_SetLen (turtle_view, pic->width, pic->height);
|
||||
View_SetGravity (turtle_view, grav_northwest);
|
||||
Ent_SetComponent (turtle_view.id, hud_pic, turtle_view.reg, &pic);
|
||||
View_SetVisible (turtle_view, 0);
|
||||
|
||||
Cvar_Register (&scr_showpause_cvar, 0, 0);
|
||||
Cvar_Register (&scr_showram_cvar, 0, 0);
|
||||
Cvar_Register (&scr_showturtle_cvar, 0, 0);
|
||||
|
||||
pic = r_funcs->Draw_PicFromWad ("net");
|
||||
net_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (net_view, 64, 0);
|
||||
View_SetLen (net_view, pic->width, pic->height);
|
||||
View_SetGravity (net_view, grav_northwest);
|
||||
Ent_SetComponent (net_view.id, hud_pic, net_view.reg, &pic);
|
||||
View_SetVisible (net_view, 0);
|
||||
|
||||
timegraph_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (timegraph_view, 0, 0);
|
||||
View_SetLen (timegraph_view, r_data->vid->width, 100);
|
||||
View_SetGravity (timegraph_view, grav_southwest);
|
||||
Ent_SetComponent (timegraph_view.id, hud_func, timegraph_view.reg,
|
||||
R_TimeGraph);
|
||||
View_SetVisible (timegraph_view, r_timegraph);
|
||||
|
||||
zgraph_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (zgraph_view, 0, 0);
|
||||
View_SetLen (zgraph_view, r_data->vid->width, 100);
|
||||
View_SetGravity (zgraph_view, grav_southwest);
|
||||
Ent_SetComponent (zgraph_view.id, hud_func, zgraph_view.reg, R_ZGraph);
|
||||
View_SetVisible (zgraph_view, r_zgraph);
|
||||
|
||||
const char *name = "gfx/loading.lmp";
|
||||
pic = r_funcs->Draw_CachePic (name, 1);
|
||||
loading_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (loading_view, 0, -24);
|
||||
View_SetLen (loading_view, pic->width, pic->height);
|
||||
View_SetGravity (loading_view, grav_center);
|
||||
Ent_SetComponent (loading_view.id, hud_cachepic, loading_view.reg, &name);
|
||||
View_SetVisible (loading_view, 0);
|
||||
|
||||
name = "gfx/pause.lmp";
|
||||
pic = r_funcs->Draw_CachePic (name, 1);
|
||||
pause_view = View_New (hud_registry, cl_screen_view);
|
||||
View_SetPos (pause_view, 0, -24);
|
||||
View_SetLen (pause_view, pic->width, pic->height);
|
||||
View_SetGravity (pause_view, grav_center);
|
||||
Ent_SetComponent (pause_view.id, hud_cachepic, pause_view.reg, &name);
|
||||
View_SetVisible (pause_view, 0);
|
||||
}
|
||||
|
||||
void
|
||||
CL_UpdateScreen (double realtime)
|
||||
{
|
||||
unsigned index = cl.intermission;
|
||||
|
||||
if (index >= sizeof (scr_funcs) / sizeof (scr_funcs[0]))
|
||||
index = 0;
|
||||
|
||||
//FIXME not every time
|
||||
if (cls.state == ca_active) {
|
||||
if (cl.watervis)
|
||||
r_data->min_wateralpha = 0.0;
|
||||
else
|
||||
r_data->min_wateralpha = 1.0;
|
||||
}
|
||||
scr_funcs_normal[0] = r_funcs->Draw_Crosshair;
|
||||
|
||||
cl.viewstate.intermission = cl.intermission != 0;
|
||||
V_PrepBlend (&cl.viewstate);
|
||||
V_RenderView (&cl.viewstate);
|
||||
SCR_UpdateScreen (cl.viewstate.camera_transform,
|
||||
realtime, scr_funcs[index]);
|
||||
}
|
|
@ -43,6 +43,7 @@
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "client/screen.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "qw/include/cl_parse.h"
|
||||
|
@ -99,7 +100,8 @@ Skin_NextDownload (void)
|
|||
|
||||
if (cls.downloadnumber == 0) {
|
||||
Sys_Printf ("Checking skins...\n");
|
||||
CL_UpdateScreen (realtime);
|
||||
cl.viewstate.time = realtime;
|
||||
CL_UpdateScreen (&cl.viewstate);
|
||||
}
|
||||
cls.downloadtype = dl_skin;
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "compat.h"
|
||||
|
||||
#include "client/hud.h"
|
||||
#include "client/screen.h"
|
||||
#include "client/world.h"
|
||||
|
||||
#include "qw/bothdefs.h"
|
||||
|
|
Loading…
Reference in a new issue