Add listlights command
This commit is contained in:
parent
441bb2a3ca
commit
583164f7a5
|
@ -33,8 +33,8 @@ typedef struct
|
|||
float map[MAX_QPATH];
|
||||
} clightstyle_t;
|
||||
|
||||
clightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
int lastofs;
|
||||
static clightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
static int lastofs;
|
||||
|
||||
void
|
||||
CL_ClearLightStyles(void)
|
||||
|
@ -108,7 +108,7 @@ CL_AddLightStyles(void)
|
|||
}
|
||||
}
|
||||
|
||||
cdlight_t cl_dlights[MAX_DLIGHTS];
|
||||
static cdlight_t cl_dlights[MAX_DLIGHTS];
|
||||
|
||||
void
|
||||
CL_ClearDlights(void)
|
||||
|
@ -153,19 +153,6 @@ CL_AllocDlight(int key)
|
|||
return dl;
|
||||
}
|
||||
|
||||
void
|
||||
CL_NewDlight(int key, float x, float y, float z, float radius, float time)
|
||||
{
|
||||
cdlight_t *dl;
|
||||
|
||||
dl = CL_AllocDlight(key);
|
||||
dl->origin[0] = x;
|
||||
dl->origin[1] = y;
|
||||
dl->origin[2] = z;
|
||||
dl->radius = radius;
|
||||
dl->die = cl.time + time;
|
||||
}
|
||||
|
||||
void
|
||||
CL_RunDLights(void)
|
||||
{
|
||||
|
|
|
@ -46,22 +46,20 @@ cvar_t *crosshair_3d_glow_b;
|
|||
|
||||
cvar_t *cl_stats;
|
||||
|
||||
int r_numdlights;
|
||||
dlight_t r_dlights[MAX_DLIGHTS];
|
||||
static int r_numdlights;
|
||||
static dlight_t r_dlights[MAX_DLIGHTS];
|
||||
|
||||
int r_numentities;
|
||||
entity_t r_entities[MAX_ENTITIES];
|
||||
static int r_numentities;
|
||||
static entity_t r_entities[MAX_ENTITIES];
|
||||
|
||||
int r_numparticles;
|
||||
particle_t r_particles[MAX_PARTICLES];
|
||||
static int r_numparticles;
|
||||
static particle_t r_particles[MAX_PARTICLES];
|
||||
|
||||
lightstyle_t r_lightstyles[MAX_LIGHTSTYLES];
|
||||
static lightstyle_t r_lightstyles[MAX_LIGHTSTYLES];
|
||||
|
||||
char cl_weaponmodels[MAX_CLIENTWEAPONMODELS][MAX_QPATH];
|
||||
int num_cl_weaponmodels;
|
||||
|
||||
void V_Render3dCrosshair(void);
|
||||
|
||||
/*
|
||||
* Specifies the model that will be used as the world
|
||||
*/
|
||||
|
@ -139,7 +137,7 @@ V_AddLightStyle(int style, float r, float g, float b)
|
|||
/*
|
||||
*If cl_testparticles is set, create 4096 particles in the view
|
||||
*/
|
||||
void
|
||||
static void
|
||||
V_TestParticles(void)
|
||||
{
|
||||
particle_t *p;
|
||||
|
@ -169,7 +167,7 @@ V_TestParticles(void)
|
|||
/*
|
||||
* If cl_testentities is set, create 32 player models
|
||||
*/
|
||||
void
|
||||
static void
|
||||
V_TestEntities(void)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -200,18 +198,20 @@ V_TestEntities(void)
|
|||
/*
|
||||
* If cl_testlights is set, create 32 lights models
|
||||
*/
|
||||
void
|
||||
static void
|
||||
V_TestLights(void)
|
||||
{
|
||||
int i, j;
|
||||
float f, r;
|
||||
dlight_t *dl;
|
||||
int i;
|
||||
|
||||
r_numdlights = 32;
|
||||
r_numdlights = MAX_DLIGHTS;
|
||||
memset(r_dlights, 0, sizeof(r_dlights));
|
||||
|
||||
for (i = 0; i < r_numdlights; i++)
|
||||
{
|
||||
dlight_t *dl;
|
||||
float f, r;
|
||||
int j;
|
||||
|
||||
dl = &r_dlights[i];
|
||||
|
||||
r = 64 * ((i % 4) - 1.5f);
|
||||
|
@ -230,6 +230,43 @@ V_TestLights(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
V_Listlights_f(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
Com_Printf("LigthStyle:\n");
|
||||
for (i = 0; i < MAX_LIGHTSTYLES; i++)
|
||||
{
|
||||
lightstyle_t *ls;
|
||||
|
||||
ls = &r_lightstyles[i];
|
||||
|
||||
if (ls->white == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Com_Printf("%d: rgb: (%.2f, %.2f, %.2f)\n",
|
||||
i, ls->rgb[0], ls->rgb[1], ls->rgb[2]);
|
||||
}
|
||||
|
||||
Com_Printf("DLigths:\n");
|
||||
for (i = 0; i < r_numdlights; i++)
|
||||
{
|
||||
dlight_t *dl;
|
||||
|
||||
dl = &r_dlights[i];
|
||||
|
||||
Com_Printf("%d: intensity: %.2f rgb: (%.2f, %.2f, %.2f) origin: (%.2f, %.2f, %.2f)\n",
|
||||
i, dl->intensity, dl->color[0], dl->color[1], dl->color[2],
|
||||
dl->origin[0], dl->origin[1], dl->origin[2]
|
||||
);
|
||||
}
|
||||
|
||||
Com_Printf("DLigths: %d\n", r_numdlights);
|
||||
}
|
||||
|
||||
static void
|
||||
CL_ClearLine(void)
|
||||
{
|
||||
|
@ -420,14 +457,14 @@ CalcFov(float fov_x, float width, float height)
|
|||
}
|
||||
|
||||
/* gun frame debugging functions */
|
||||
void
|
||||
static void
|
||||
V_Gun_Next_f(void)
|
||||
{
|
||||
gun_frame++;
|
||||
Com_Printf("frame %i\n", gun_frame);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
V_Gun_Prev_f(void)
|
||||
{
|
||||
gun_frame--;
|
||||
|
@ -440,7 +477,7 @@ V_Gun_Prev_f(void)
|
|||
Com_Printf("frame %i\n", gun_frame);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
V_Gun_Model_f(void)
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
|
@ -455,7 +492,7 @@ V_Gun_Model_f(void)
|
|||
gun_model = R_RegisterModel(name);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
entitycmpfnc(const entity_t *a, const entity_t *b)
|
||||
{
|
||||
/* all other models are sorted by model then skin */
|
||||
|
@ -470,6 +507,52 @@ entitycmpfnc(const entity_t *a, const entity_t *b)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
V_Render3dCrosshair(void)
|
||||
{
|
||||
trace_t crosshair_trace;
|
||||
vec3_t end;
|
||||
|
||||
crosshair_3d = Cvar_Get("crosshair_3d", "0", CVAR_ARCHIVE);
|
||||
crosshair_3d_glow = Cvar_Get("crosshair_3d_glow", "0", CVAR_ARCHIVE);
|
||||
|
||||
|
||||
if(crosshair_3d->value || crosshair_3d_glow->value){
|
||||
VectorMA(cl.refdef.vieworg,8192,cl.v_forward,end);
|
||||
crosshair_trace = CL_PMTrace(cl.refdef.vieworg, vec3_origin, vec3_origin, end);
|
||||
|
||||
if(crosshair_3d_glow->value){
|
||||
crosshair_3d_glow_r = Cvar_Get("crosshair_3d_glow_r", "5", CVAR_ARCHIVE);
|
||||
crosshair_3d_glow_g = Cvar_Get("crosshair_3d_glow_g", "1", CVAR_ARCHIVE);
|
||||
crosshair_3d_glow_b = Cvar_Get("crosshair_3d_glow_b", "4", CVAR_ARCHIVE);
|
||||
|
||||
V_AddLight(
|
||||
crosshair_trace.endpos,
|
||||
crosshair_3d_glow->value,
|
||||
crosshair_3d_glow_r->value,
|
||||
crosshair_3d_glow_g->value,
|
||||
crosshair_3d_glow_b->value
|
||||
);
|
||||
}
|
||||
|
||||
if(crosshair_3d->value){
|
||||
entity_t crosshair_ent = {0};
|
||||
|
||||
crosshair_ent.origin[0] = crosshair_trace.endpos[0];
|
||||
crosshair_ent.origin[1] = crosshair_trace.endpos[1];
|
||||
crosshair_ent.origin[2] = crosshair_trace.endpos[2];
|
||||
|
||||
crosshair_ent.model = R_RegisterModel("models/crosshair/tris.md2");
|
||||
//crosshair_ent.skin = R_RegisterSkin("models/crosshair/skin.pcx");
|
||||
|
||||
AngleVectors2(crosshair_trace.plane.normal, crosshair_ent.angles);
|
||||
crosshair_ent.flags = RF_DEPTHHACK | RF_FULLBRIGHT | RF_NOSHADOW;
|
||||
|
||||
V_AddEntity(&crosshair_ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
V_RenderView(float stereo_separation)
|
||||
{
|
||||
|
@ -632,53 +715,7 @@ V_RenderView(float stereo_separation)
|
|||
SCR_DrawCrosshair();
|
||||
}
|
||||
|
||||
void
|
||||
V_Render3dCrosshair(void)
|
||||
{
|
||||
trace_t crosshair_trace;
|
||||
vec3_t end;
|
||||
|
||||
crosshair_3d = Cvar_Get("crosshair_3d", "0", CVAR_ARCHIVE);
|
||||
crosshair_3d_glow = Cvar_Get("crosshair_3d_glow", "0", CVAR_ARCHIVE);
|
||||
|
||||
|
||||
if(crosshair_3d->value || crosshair_3d_glow->value){
|
||||
VectorMA(cl.refdef.vieworg,8192,cl.v_forward,end);
|
||||
crosshair_trace = CL_PMTrace(cl.refdef.vieworg, vec3_origin, vec3_origin, end);
|
||||
|
||||
if(crosshair_3d_glow->value){
|
||||
crosshair_3d_glow_r = Cvar_Get("crosshair_3d_glow_r", "5", CVAR_ARCHIVE);
|
||||
crosshair_3d_glow_g = Cvar_Get("crosshair_3d_glow_g", "1", CVAR_ARCHIVE);
|
||||
crosshair_3d_glow_b = Cvar_Get("crosshair_3d_glow_b", "4", CVAR_ARCHIVE);
|
||||
|
||||
V_AddLight(
|
||||
crosshair_trace.endpos,
|
||||
crosshair_3d_glow->value,
|
||||
crosshair_3d_glow_r->value,
|
||||
crosshair_3d_glow_g->value,
|
||||
crosshair_3d_glow_b->value
|
||||
);
|
||||
}
|
||||
|
||||
if(crosshair_3d->value){
|
||||
entity_t crosshair_ent = {0};
|
||||
|
||||
crosshair_ent.origin[0] = crosshair_trace.endpos[0];
|
||||
crosshair_ent.origin[1] = crosshair_trace.endpos[1];
|
||||
crosshair_ent.origin[2] = crosshair_trace.endpos[2];
|
||||
|
||||
crosshair_ent.model = R_RegisterModel("models/crosshair/tris.md2");
|
||||
//crosshair_ent.skin = R_RegisterSkin("models/crosshair/skin.pcx");
|
||||
|
||||
AngleVectors2(crosshair_trace.plane.normal, crosshair_ent.angles);
|
||||
crosshair_ent.flags = RF_DEPTHHACK | RF_FULLBRIGHT | RF_NOSHADOW;
|
||||
|
||||
V_AddEntity(&crosshair_ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
V_Viewpos_f(void)
|
||||
{
|
||||
Com_Printf("position: %i %i %i, angles: %i %i %i\n",
|
||||
|
@ -696,6 +733,7 @@ V_Init(void)
|
|||
Cmd_AddCommand("gun_model", V_Gun_Model_f);
|
||||
|
||||
Cmd_AddCommand("viewpos", V_Viewpos_f);
|
||||
Cmd_AddCommand("listlights", V_Listlights_f);
|
||||
|
||||
crosshair = Cvar_Get("crosshair", "0", CVAR_ARCHIVE);
|
||||
crosshair_scale = Cvar_Get("crosshair_scale", "-1", CVAR_ARCHIVE);
|
||||
|
|
|
@ -329,7 +329,6 @@ typedef struct
|
|||
} cdlight_t;
|
||||
|
||||
extern centity_t cl_entities[MAX_EDICTS];
|
||||
extern cdlight_t cl_dlights[MAX_DLIGHTS];
|
||||
|
||||
extern entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
|
||||
|
||||
|
|
Loading…
Reference in New Issue