mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-17 01:21:12 +00:00
cl_view.c neu kommentiert und formatiert
This commit is contained in:
parent
7f86a17ddf
commit
ca2e9c48e7
1 changed files with 154 additions and 244 deletions
|
@ -1,35 +1,29 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 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 the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// cl_view.c -- player rendering positioning
|
||||
* Copyright (C) 1997-2001 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 the Free Software Foundation, Inc., 59
|
||||
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "header/client.h"
|
||||
|
||||
//=============
|
||||
//
|
||||
// development tools for weapons
|
||||
//
|
||||
int gun_frame;
|
||||
/* development tools for weapons */
|
||||
int gun_frame;
|
||||
struct model_s *gun_model;
|
||||
|
||||
//=============
|
||||
|
||||
cvar_t *crosshair;
|
||||
cvar_t *crosshair_scale;
|
||||
cvar_t *cl_testparticles;
|
||||
|
@ -55,62 +49,39 @@ char cl_weaponmodels[MAX_CLIENTWEAPONMODELS][MAX_QPATH];
|
|||
int num_cl_weaponmodels;
|
||||
|
||||
/*
|
||||
====================
|
||||
V_ClearScene
|
||||
|
||||
Specifies the model that will be used as the world
|
||||
====================
|
||||
*/
|
||||
void V_ClearScene (void)
|
||||
{
|
||||
* Specifies the model that will be used as the world
|
||||
*/
|
||||
void V_ClearScene (void) {
|
||||
r_numdlights = 0;
|
||||
r_numentities = 0;
|
||||
r_numparticles = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
V_AddEntity
|
||||
|
||||
=====================
|
||||
*/
|
||||
void V_AddEntity (entity_t *ent)
|
||||
{
|
||||
void V_AddEntity (entity_t *ent) {
|
||||
if (r_numentities >= MAX_ENTITIES)
|
||||
return;
|
||||
|
||||
r_entities[r_numentities++] = *ent;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
V_AddParticle
|
||||
|
||||
=====================
|
||||
*/
|
||||
void V_AddParticle (vec3_t org, unsigned int color, float alpha)
|
||||
{
|
||||
void V_AddParticle (vec3_t org, unsigned int color, float alpha) {
|
||||
particle_t *p;
|
||||
|
||||
if (r_numparticles >= MAX_PARTICLES)
|
||||
return;
|
||||
|
||||
p = &r_particles[r_numparticles++];
|
||||
VectorCopy (org, p->origin);
|
||||
p->color = color;
|
||||
p->alpha = alpha;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
V_AddLight
|
||||
|
||||
=====================
|
||||
*/
|
||||
void V_AddLight (vec3_t org, float intensity, float r, float g, float b)
|
||||
{
|
||||
void V_AddLight (vec3_t org, float intensity, float r, float g, float b) {
|
||||
dlight_t *dl;
|
||||
|
||||
if (r_numdlights >= MAX_DLIGHTS)
|
||||
return;
|
||||
|
||||
dl = &r_dlights[r_numdlights++];
|
||||
VectorCopy (org, dl->origin);
|
||||
dl->intensity = intensity;
|
||||
|
@ -119,18 +90,12 @@ void V_AddLight (vec3_t org, float intensity, float r, float g, float b)
|
|||
dl->color[2] = b;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
V_AddLightStyle
|
||||
|
||||
=====================
|
||||
*/
|
||||
void V_AddLightStyle (int style, float r, float g, float b)
|
||||
{
|
||||
void V_AddLightStyle (int style, float r, float g, float b) {
|
||||
lightstyle_t *ls;
|
||||
|
||||
if (style < 0 || style > MAX_LIGHTSTYLES)
|
||||
Com_Error (ERR_DROP, "Bad light style %i", style);
|
||||
|
||||
ls = &r_lightstyles[style];
|
||||
|
||||
ls->white = r+g+b;
|
||||
|
@ -140,21 +105,16 @@ void V_AddLightStyle (int style, float r, float g, float b)
|
|||
}
|
||||
|
||||
/*
|
||||
================
|
||||
V_TestParticles
|
||||
|
||||
If cl_testparticles is set, create 4096 particles in the view
|
||||
================
|
||||
*/
|
||||
void V_TestParticles (void)
|
||||
{
|
||||
*If cl_testparticles is set, create 4096 particles in the view
|
||||
*/
|
||||
void V_TestParticles (void) {
|
||||
particle_t *p;
|
||||
int i, j;
|
||||
float d, r, u;
|
||||
|
||||
r_numparticles = MAX_PARTICLES;
|
||||
for (i=0 ; i<r_numparticles ; i++)
|
||||
{
|
||||
|
||||
for (i=0 ; i<r_numparticles ; i++) {
|
||||
d = i*0.25f;
|
||||
r = 4*((i&7)-3.5f);
|
||||
u = 4*(((i>>3)&7)-3.5f);
|
||||
|
@ -162,7 +122,7 @@ void V_TestParticles (void)
|
|||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j]*d +
|
||||
cl.v_right[j]*r + cl.v_up[j]*u;
|
||||
cl.v_right[j]*r + cl.v_up[j]*u;
|
||||
|
||||
p->color = 8;
|
||||
p->alpha = cl_testparticles->value;
|
||||
|
@ -170,14 +130,9 @@ void V_TestParticles (void)
|
|||
}
|
||||
|
||||
/*
|
||||
================
|
||||
V_TestEntities
|
||||
|
||||
If cl_testentities is set, create 32 player models
|
||||
================
|
||||
*/
|
||||
void V_TestEntities (void)
|
||||
{
|
||||
* If cl_testentities is set, create 32 player models
|
||||
*/
|
||||
void V_TestEntities (void) {
|
||||
int i, j;
|
||||
float f, r;
|
||||
entity_t *ent;
|
||||
|
@ -185,8 +140,7 @@ void V_TestEntities (void)
|
|||
r_numentities = 32;
|
||||
memset (r_entities, 0, sizeof(r_entities));
|
||||
|
||||
for (i=0 ; i<r_numentities ; i++)
|
||||
{
|
||||
for (i=0 ; i<r_numentities ; i++) {
|
||||
ent = &r_entities[i];
|
||||
|
||||
r = 64 * ( (i%4) - 1.5 );
|
||||
|
@ -194,7 +148,7 @@ void V_TestEntities (void)
|
|||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
ent->origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j]*f +
|
||||
cl.v_right[j]*r;
|
||||
cl.v_right[j]*r;
|
||||
|
||||
ent->model = cl.baseclientinfo.model;
|
||||
ent->skin = cl.baseclientinfo.skin;
|
||||
|
@ -202,14 +156,9 @@ void V_TestEntities (void)
|
|||
}
|
||||
|
||||
/*
|
||||
================
|
||||
V_TestLights
|
||||
|
||||
If cl_testlights is set, create 32 lights models
|
||||
================
|
||||
*/
|
||||
void V_TestLights (void)
|
||||
{
|
||||
* If cl_testlights is set, create 32 lights models
|
||||
*/
|
||||
void V_TestLights (void) {
|
||||
int i, j;
|
||||
float f, r;
|
||||
dlight_t *dl;
|
||||
|
@ -217,8 +166,7 @@ void V_TestLights (void)
|
|||
r_numdlights = 32;
|
||||
memset (r_dlights, 0, sizeof(r_dlights));
|
||||
|
||||
for (i=0 ; i<r_numdlights ; i++)
|
||||
{
|
||||
for (i=0 ; i<r_numdlights ; i++) {
|
||||
dl = &r_dlights[i];
|
||||
|
||||
r = 64 * ( (i%4) - 1.5f );
|
||||
|
@ -226,7 +174,8 @@ void V_TestLights (void)
|
|||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
dl->origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j]*f +
|
||||
cl.v_right[j]*r;
|
||||
cl.v_right[j]*r;
|
||||
|
||||
dl->color[0] = (float)(((i%6)+1) & 1);
|
||||
dl->color[1] = (float)((((i%6)+1) & 2)>>1);
|
||||
dl->color[2] = (float)((((i%6)+1) & 4)>>2);
|
||||
|
@ -234,17 +183,10 @@ void V_TestLights (void)
|
|||
}
|
||||
}
|
||||
|
||||
//===================================================================
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_PrepRefresh
|
||||
|
||||
Call before entering a new level, or after changing dlls
|
||||
=================
|
||||
*/
|
||||
void CL_PrepRefresh (void)
|
||||
{
|
||||
* Call before entering a new level, or after changing dlls
|
||||
*/
|
||||
void CL_PrepRefresh (void) {
|
||||
char mapname[32];
|
||||
int i;
|
||||
char name[MAX_QPATH];
|
||||
|
@ -252,23 +194,23 @@ void CL_PrepRefresh (void)
|
|||
vec3_t axis;
|
||||
|
||||
if (!cl.configstrings[CS_MODELS+1][0])
|
||||
return; // no map loaded
|
||||
return;
|
||||
|
||||
SCR_AddDirtyPoint (0, 0);
|
||||
SCR_AddDirtyPoint (viddef.width-1, viddef.height-1);
|
||||
|
||||
// let the render dll load the map
|
||||
strcpy (mapname, cl.configstrings[CS_MODELS+1] + 5); // skip "maps/"
|
||||
mapname[strlen(mapname)-4] = 0; // cut off ".bsp"
|
||||
/* let the refresher load the map */
|
||||
strcpy (mapname, cl.configstrings[CS_MODELS+1] + 5); /* skip "maps/" */
|
||||
mapname[strlen(mapname)-4] = 0; /* cut off ".bsp" */
|
||||
|
||||
// register models, pics, and skins
|
||||
Com_Printf ("Map: %s\r", mapname);
|
||||
/* register models, pics, and skins */
|
||||
Com_Printf ("Map: %s\r", mapname);
|
||||
SCR_UpdateScreen ();
|
||||
re.BeginRegistration (mapname);
|
||||
Com_Printf (" \r");
|
||||
|
||||
// precache status bar pics
|
||||
Com_Printf ("pics\r");
|
||||
/* precache status bar pics */
|
||||
Com_Printf ("pics\r");
|
||||
SCR_UpdateScreen ();
|
||||
SCR_TouchPics ();
|
||||
Com_Printf (" \r");
|
||||
|
@ -278,104 +220,99 @@ void CL_PrepRefresh (void)
|
|||
num_cl_weaponmodels = 1;
|
||||
strcpy(cl_weaponmodels[0], "weapon.md2");
|
||||
|
||||
for (i=1 ; i<MAX_MODELS && cl.configstrings[CS_MODELS+i][0] ; i++)
|
||||
{
|
||||
for (i=1 ; i<MAX_MODELS && cl.configstrings[CS_MODELS+i][0] ; i++) {
|
||||
strcpy (name, cl.configstrings[CS_MODELS+i]);
|
||||
name[37] = 0; // never go beyond one line
|
||||
name[37] = 0; /* never go beyond one line */
|
||||
|
||||
if (name[0] != '*')
|
||||
Com_Printf ("%s\r", name);
|
||||
Com_Printf ("%s\r", name);
|
||||
|
||||
SCR_UpdateScreen ();
|
||||
Sys_SendKeyEvents (); // pump message loop
|
||||
if (name[0] == '#')
|
||||
{
|
||||
// special player weapon model
|
||||
if (num_cl_weaponmodels < MAX_CLIENTWEAPONMODELS)
|
||||
{
|
||||
Sys_SendKeyEvents ();
|
||||
|
||||
if (name[0] == '#') {
|
||||
/* special player weapon model */
|
||||
if (num_cl_weaponmodels < MAX_CLIENTWEAPONMODELS) {
|
||||
strncpy(cl_weaponmodels[num_cl_weaponmodels], cl.configstrings[CS_MODELS+i]+1,
|
||||
sizeof(cl_weaponmodels[num_cl_weaponmodels]) - 1);
|
||||
sizeof(cl_weaponmodels[num_cl_weaponmodels]) - 1);
|
||||
num_cl_weaponmodels++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
cl.model_draw[i] = re.RegisterModel (cl.configstrings[CS_MODELS+i]);
|
||||
|
||||
if (name[0] == '*')
|
||||
cl.model_clip[i] = CM_InlineModel (cl.configstrings[CS_MODELS+i]);
|
||||
|
||||
else
|
||||
cl.model_clip[i] = NULL;
|
||||
}
|
||||
|
||||
if (name[0] != '*')
|
||||
Com_Printf (" \r");
|
||||
}
|
||||
|
||||
Com_Printf ("images\r", i);
|
||||
Com_Printf ("images\r", i);
|
||||
SCR_UpdateScreen ();
|
||||
for (i=1 ; i<MAX_IMAGES && cl.configstrings[CS_IMAGES+i][0] ; i++)
|
||||
{
|
||||
|
||||
for (i=1 ; i<MAX_IMAGES && cl.configstrings[CS_IMAGES+i][0] ; i++) {
|
||||
cl.image_precache[i] = re.RegisterPic (cl.configstrings[CS_IMAGES+i]);
|
||||
Sys_SendKeyEvents (); // pump message loop
|
||||
Sys_SendKeyEvents ();
|
||||
}
|
||||
|
||||
|
||||
Com_Printf (" \r");
|
||||
for (i=0 ; i<MAX_CLIENTS ; i++)
|
||||
{
|
||||
|
||||
for (i=0 ; i<MAX_CLIENTS ; i++) {
|
||||
if (!cl.configstrings[CS_PLAYERSKINS+i][0])
|
||||
continue;
|
||||
Com_Printf ("client %i\r", i);
|
||||
|
||||
Com_Printf ("client %i\r", i);
|
||||
SCR_UpdateScreen ();
|
||||
Sys_SendKeyEvents (); // pump message loop
|
||||
Sys_SendKeyEvents ();
|
||||
CL_ParseClientinfo (i);
|
||||
Com_Printf (" \r");
|
||||
}
|
||||
|
||||
CL_LoadClientinfo (&cl.baseclientinfo, "unnamed\\male/grunt");
|
||||
|
||||
// set sky textures and speed
|
||||
Com_Printf ("sky\r", i);
|
||||
/* set sky textures and speed */
|
||||
Com_Printf ("sky\r", i);
|
||||
SCR_UpdateScreen ();
|
||||
rotate = (float)atof (cl.configstrings[CS_SKYROTATE]);
|
||||
sscanf (cl.configstrings[CS_SKYAXIS], "%f %f %f",
|
||||
&axis[0], &axis[1], &axis[2]);
|
||||
sscanf (cl.configstrings[CS_SKYAXIS], "%f %f %f",
|
||||
&axis[0], &axis[1], &axis[2]);
|
||||
re.SetSky (cl.configstrings[CS_SKY], rotate, axis);
|
||||
Com_Printf (" \r");
|
||||
|
||||
// the renderer can now free unneeded stuff
|
||||
/* the renderer can now free unneeded stuff */
|
||||
re.EndRegistration ();
|
||||
|
||||
// clear any lines of console text
|
||||
/* clear any lines of console text */
|
||||
Con_ClearNotify ();
|
||||
|
||||
SCR_UpdateScreen ();
|
||||
cl.refresh_prepped = true;
|
||||
cl.force_refdef = true; // make sure we have a valid refdef
|
||||
cl.force_refdef = true; /* make sure we have a valid refdef */
|
||||
|
||||
// start the cd track
|
||||
if (Cvar_VariableValue("cd_shuffle")){
|
||||
CDAudio_RandomPlay();
|
||||
}
|
||||
else{
|
||||
CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true);
|
||||
/* start the cd track */
|
||||
if (Cvar_VariableValue("cd_shuffle")) {
|
||||
CDAudio_RandomPlay();
|
||||
|
||||
} else {
|
||||
CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true);
|
||||
|
||||
/* OGG/Vorbis */
|
||||
if (atoi(cl.configstrings[CS_CDTRACK]) < 10)
|
||||
{
|
||||
if (atoi(cl.configstrings[CS_CDTRACK]) < 10) {
|
||||
char tmp[3] = "0";
|
||||
OGG_ParseCmd(strcat(tmp, cl.configstrings[CS_CDTRACK]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
OGG_ParseCmd(cl.configstrings[CS_CDTRACK]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CalcFov
|
||||
====================
|
||||
*/
|
||||
float CalcFov (float fov_x, float width, float height)
|
||||
{
|
||||
float CalcFov (float fov_x, float width, float height) {
|
||||
float a;
|
||||
float x;
|
||||
|
||||
|
@ -391,60 +328,48 @@ float CalcFov (float fov_x, float width, float height)
|
|||
return a;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
// gun frame debugging functions
|
||||
void V_Gun_Next_f (void)
|
||||
{
|
||||
/* gun frame debugging functions */
|
||||
void V_Gun_Next_f (void) {
|
||||
gun_frame++;
|
||||
Com_Printf ("frame %i\n", gun_frame);
|
||||
}
|
||||
|
||||
void V_Gun_Prev_f (void)
|
||||
{
|
||||
void V_Gun_Prev_f (void) {
|
||||
gun_frame--;
|
||||
|
||||
if (gun_frame < 0)
|
||||
gun_frame = 0;
|
||||
|
||||
Com_Printf ("frame %i\n", gun_frame);
|
||||
}
|
||||
|
||||
void V_Gun_Model_f (void)
|
||||
{
|
||||
void V_Gun_Model_f (void) {
|
||||
char name[MAX_QPATH];
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
{
|
||||
if (Cmd_Argc() != 2) {
|
||||
gun_model = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
Com_sprintf (name, sizeof(name), "models/%s/tris.md2", Cmd_Argv(1));
|
||||
gun_model = re.RegisterModel (name);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
SCR_DrawCrosshair
|
||||
=================
|
||||
*/
|
||||
void SCR_DrawCrosshair (void)
|
||||
{
|
||||
void SCR_DrawCrosshair (void) {
|
||||
if (!crosshair->value)
|
||||
return;
|
||||
|
||||
if (crosshair->modified)
|
||||
{
|
||||
if (crosshair->modified) {
|
||||
crosshair->modified = false;
|
||||
SCR_TouchPics ();
|
||||
}
|
||||
|
||||
if (crosshair_scale->modified)
|
||||
{
|
||||
if (crosshair_scale->modified) {
|
||||
crosshair_scale->modified=false;
|
||||
|
||||
if (crosshair_scale->value>5)
|
||||
Cvar_SetValue("crosshair_scale", 5);
|
||||
|
||||
else if (crosshair_scale->value<0.25)
|
||||
Cvar_SetValue("crosshair_scale", 0.25);
|
||||
}
|
||||
|
@ -453,71 +378,65 @@ void SCR_DrawCrosshair (void)
|
|||
return;
|
||||
|
||||
re.DrawPic (scr_vrect.x + ((scr_vrect.width - crosshair_width)>>1)
|
||||
, scr_vrect.y + ((scr_vrect.height - crosshair_height)>>1), crosshair_pic);
|
||||
, scr_vrect.y + ((scr_vrect.height - crosshair_height)>>1), crosshair_pic);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_RenderView
|
||||
|
||||
==================
|
||||
*/
|
||||
void V_RenderView( float stereo_separation )
|
||||
{
|
||||
void V_RenderView( float stereo_separation ) {
|
||||
extern int entitycmpfnc( const entity_t *, const entity_t * );
|
||||
|
||||
if (cls.state != ca_active)
|
||||
return;
|
||||
|
||||
if (!cl.refresh_prepped)
|
||||
return; // still loading
|
||||
return;
|
||||
|
||||
if (cl_timedemo->value)
|
||||
{
|
||||
if (cl_timedemo->value) {
|
||||
if (!cl.timedemo_start)
|
||||
cl.timedemo_start = Sys_Milliseconds ();
|
||||
|
||||
cl.timedemo_frames++;
|
||||
}
|
||||
|
||||
// an invalid frame will just use the exact previous refdef
|
||||
// we can't use the old frame if the video mode has changed, though...
|
||||
if ( cl.frame.valid && (cl.force_refdef || !cl_paused->value) )
|
||||
{
|
||||
/* an invalid frame will just use the exact previous refdef
|
||||
we can't use the old frame if the video mode has changed, though... */
|
||||
if ( cl.frame.valid && (cl.force_refdef || !cl_paused->value) ) {
|
||||
cl.force_refdef = false;
|
||||
|
||||
V_ClearScene ();
|
||||
|
||||
// build a refresh entity list and calc cl.sim*
|
||||
// this also calls CL_CalcViewValues which loads
|
||||
// v_forward, etc.
|
||||
/* build a refresh entity list and calc cl.sim*
|
||||
this also calls CL_CalcViewValues which loads
|
||||
v_forward, etc. */
|
||||
CL_AddEntities ();
|
||||
|
||||
if (cl_testparticles->value)
|
||||
V_TestParticles ();
|
||||
|
||||
if (cl_testentities->value)
|
||||
V_TestEntities ();
|
||||
|
||||
if (cl_testlights->value)
|
||||
V_TestLights ();
|
||||
if (cl_testblend->value)
|
||||
{
|
||||
|
||||
if (cl_testblend->value) {
|
||||
cl.refdef.blend[0] = 1;
|
||||
cl.refdef.blend[1] = 0.5;
|
||||
cl.refdef.blend[2] = 0.25;
|
||||
cl.refdef.blend[3] = 0.5;
|
||||
}
|
||||
|
||||
// offset vieworg appropriately if we're doing stereo separation
|
||||
if ( stereo_separation != 0 )
|
||||
{
|
||||
vec3_t tmp;
|
||||
|
||||
VectorScale( cl.v_right, stereo_separation, tmp );
|
||||
VectorAdd( cl.refdef.vieworg, tmp, cl.refdef.vieworg );
|
||||
/* offset vieworg appropriately if
|
||||
we're doing stereo separation */
|
||||
if ( stereo_separation != 0 ) {
|
||||
vec3_t tmp;
|
||||
|
||||
VectorScale( cl.v_right, stereo_separation, tmp );
|
||||
VectorAdd( cl.refdef.vieworg, tmp, cl.refdef.vieworg );
|
||||
}
|
||||
|
||||
// never let it sit exactly on a node line, because a water plane can
|
||||
// dissapear when viewed with the eye exactly on it.
|
||||
// the server protocol only specifies to 1/8 pixel, so add 1/16 in each axis
|
||||
/* never let it sit exactly on a node line, because a water plane can
|
||||
dissapear when viewed with the eye exactly on it.
|
||||
the server protocol only specifies to 1/8 pixel, so add 1/16 in each axis */
|
||||
cl.refdef.vieworg[0] += 1.0/16;
|
||||
cl.refdef.vieworg[1] += 1.0/16;
|
||||
cl.refdef.vieworg[2] += 1.0/16;
|
||||
|
@ -533,12 +452,14 @@ void V_RenderView( float stereo_separation )
|
|||
|
||||
if (!cl_add_entities->value)
|
||||
r_numentities = 0;
|
||||
|
||||
if (!cl_add_particles->value)
|
||||
r_numparticles = 0;
|
||||
|
||||
if (!cl_add_lights->value)
|
||||
r_numdlights = 0;
|
||||
if (!cl_add_blend->value)
|
||||
{
|
||||
|
||||
if (!cl_add_blend->value) {
|
||||
VectorClear (cl.refdef.blend);
|
||||
}
|
||||
|
||||
|
@ -552,44 +473,33 @@ void V_RenderView( float stereo_separation )
|
|||
|
||||
cl.refdef.rdflags = cl.frame.playerstate.rdflags;
|
||||
|
||||
// sort entities for better cache locality
|
||||
qsort( cl.refdef.entities, cl.refdef.num_entities, sizeof( cl.refdef.entities[0] ), (int (*)(const void *, const void *))entitycmpfnc );
|
||||
/* sort entities for better cache locality */
|
||||
qsort( cl.refdef.entities, cl.refdef.num_entities, sizeof( cl.refdef.entities[0] ), (int (*)(const void *, const void *))entitycmpfnc );
|
||||
}
|
||||
|
||||
re.RenderFrame (&cl.refdef);
|
||||
|
||||
if (cl_stats->value)
|
||||
Com_Printf ("ent:%i lt:%i part:%i\n", r_numentities, r_numdlights, r_numparticles);
|
||||
|
||||
if ( log_stats->value && ( log_stats_file != 0 ) )
|
||||
fprintf( log_stats_file, "%i,%i,%i,",r_numentities, r_numdlights, r_numparticles);
|
||||
|
||||
|
||||
SCR_AddDirtyPoint (scr_vrect.x, scr_vrect.y);
|
||||
SCR_AddDirtyPoint (scr_vrect.x+scr_vrect.width-1,
|
||||
scr_vrect.y+scr_vrect.height-1);
|
||||
scr_vrect.y+scr_vrect.height-1);
|
||||
|
||||
SCR_DrawCrosshair ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
V_Viewpos_f
|
||||
=============
|
||||
*/
|
||||
void V_Viewpos_f (void)
|
||||
{
|
||||
void V_Viewpos_f (void) {
|
||||
Com_Printf ("(%i %i %i) : %i\n", (int)cl.refdef.vieworg[0],
|
||||
(int)cl.refdef.vieworg[1], (int)cl.refdef.vieworg[2],
|
||||
(int)cl.refdef.viewangles[YAW]);
|
||||
(int)cl.refdef.vieworg[1], (int)cl.refdef.vieworg[2],
|
||||
(int)cl.refdef.viewangles[YAW]);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
V_Init
|
||||
=============
|
||||
*/
|
||||
void V_Init (void)
|
||||
{
|
||||
void V_Init (void) {
|
||||
Cmd_AddCommand ("gun_next", V_Gun_Next_f);
|
||||
Cmd_AddCommand ("gun_prev", V_Gun_Prev_f);
|
||||
Cmd_AddCommand ("gun_model", V_Gun_Model_f);
|
||||
|
|
Loading…
Reference in a new issue