summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2010-03-03 15:30:29 +0000
committerAndrey Nazarov <skuller@skuller.net>2010-03-03 15:30:29 +0000
commitd46e8aad3aadbfea1a979ddd50c73e9e7ae80d9e (patch)
tree292a98928feb5024df297021314788347632e77d
parentf73160ca01dd262d2031890e697dd63963f4bc8b (diff)
Check for refresh type at compile time, not at run time.
-rw-r--r--source/cl_ents.c13
-rw-r--r--source/cl_fx.c39
-rw-r--r--source/cl_newfx.c11
-rw-r--r--source/cl_tent.c11
-rw-r--r--source/cl_view.c10
-rw-r--r--source/ui_atoms.c48
-rw-r--r--source/ui_menu.c12
7 files changed, 57 insertions, 87 deletions
diff --git a/source/cl_ents.c b/source/cl_ents.c
index d60215d..98bbe61 100644
--- a/source/cl_ents.c
+++ b/source/cl_ents.c
@@ -646,12 +646,8 @@ static void CL_AddPacketEntities( void ) {
float intensity;
intensity = 50 + (500 * (sin(cl.time/500.0) + 1.0));
- // FIXME - check out this effect in rendition
- if( scr_glconfig.renderer != GL_RENDERER_SOFTWARE )
- V_AddLight (ent.origin, intensity, -1.0, -1.0, -1.0);
- else
- V_AddLight (ent.origin, -1.0 * intensity, 1.0, 1.0, 1.0);
- }
+ V_AddLight (ent.origin, intensity, -1.0, -1.0, -1.0);
+ }
else
{
CL_Tracker_Shell (cent->lerp_origin);
@@ -662,10 +658,7 @@ static void CL_AddPacketEntities( void ) {
{
CL_TrackerTrail (cent->lerp_origin, ent.origin, 0);
// FIXME - check out this effect in rendition
- if( scr_glconfig.renderer != GL_RENDERER_SOFTWARE )
- V_AddLight (ent.origin, 200, -1, -1, -1);
- else
- V_AddLight (ent.origin, -200, 1, 1, 1);
+ V_AddLight (ent.origin, 200, -1, -1, -1);
}
//ROGUE
//======
diff --git a/source/cl_fx.c b/source/cl_fx.c
index 07aaa4b..4d173b1 100644
--- a/source/cl_fx.c
+++ b/source/cl_fx.c
@@ -206,40 +206,13 @@ void CL_AddDLights (void)
cdlight_t *dl;
dl = cl_dlights;
-
-//=====
-//PGM
- if( scr_glconfig.renderer != GL_RENDERER_SOFTWARE )
- {
- for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
- {
- if (!dl->radius)
- continue;
- V_AddLight (dl->origin, dl->radius,
- dl->color[0], dl->color[1], dl->color[2]);
- }
- }
- else
+ for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
- for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
- {
- if (!dl->radius)
- continue;
-
- // negative light in softwaref. only black allowed
- if ((dl->color[0] < 0) || (dl->color[1] < 0) || (dl->color[2] < 0))
- {
- dl->radius = -(dl->radius);
- dl->color[0] = 1;
- dl->color[1] = 1;
- dl->color[2] = 1;
- }
- V_AddLight (dl->origin, dl->radius,
- dl->color[0], dl->color[1], dl->color[2]);
- }
+ if (!dl->radius)
+ continue;
+ V_AddLight (dl->origin, dl->radius,
+ dl->color[0], dl->color[1], dl->color[2]);
}
-//PGM
-//=====
}
// ==============================================================
@@ -733,9 +706,7 @@ void CL_ParseMuzzleFlash2 (void)
case MZ2_BOSS2_MACHINEGUN_R5:
case MZ2_CARRIER_MACHINEGUN_R1: // PMM
case MZ2_CARRIER_MACHINEGUN_R2: // PMM
-
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
-
CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
break;
diff --git a/source/cl_newfx.c b/source/cl_newfx.c
index a1de0b3..77ebdf3 100644
--- a/source/cl_newfx.c
+++ b/source/cl_newfx.c
@@ -91,14 +91,6 @@ void CL_ColorFlash (vec3_t pos, int ent, int intensity, float r, float g, float
{
cdlight_t *dl;
- if(( scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) && ((r < 0) || (g<0) || (b<0)))
- {
- intensity = -intensity;
- r = -r;
- g = -g;
- b = -b;
- }
-
dl = CL_AllocDlight (ent);
VectorCopy (pos, dl->origin);
dl->radius = intensity;
@@ -429,11 +421,12 @@ void CL_Heatbeam (vec3_t start, vec3_t forward)
// MakeNormalVectors (vec, right, up);
VectorCopy (cl.v_right, right);
VectorCopy (cl.v_up, up);
- if( scr_glconfig.renderer != GL_RENDERER_SOFTWARE )
+#if USE_REF == REF_GL
{ // GL mode
VectorMA (move, -0.5, right, move);
VectorMA (move, -0.5, up, move);
}
+#endif
// otherwise assume SOFT
ltime = (float) cl.time/1000.0;
diff --git a/source/cl_tent.c b/source/cl_tent.c
index 5a4859d..17e8807 100644
--- a/source/cl_tent.c
+++ b/source/cl_tent.c
@@ -1015,6 +1015,8 @@ static void CL_ParseNuke (void) {
//==============================================================
+#if USE_REF == REF_GL
+
static color_t railcore_color;
static color_t railspiral_color;
@@ -1102,7 +1104,7 @@ static void CL_RailSpiral( void ) {
}
static void CL_RailTrail( void ) {
- if( !cl_railtrail_type->integer || scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) {
+ if( !cl_railtrail_type->integer ) {
CL_OldRailTrail( te.pos1, te.pos2 );
} else {
CL_RailCore();
@@ -1112,6 +1114,9 @@ static void CL_RailTrail( void ) {
}
}
+#else
+#define CL_RailTrail CL_OldRailTrail
+#endif
static void dirtoangles( vec3_t angles ) {
angles[0] = acos(te.dir[2])/M_PI*180;
@@ -1522,6 +1527,7 @@ void CL_ClearTEnts (void) {
void CL_InitTEnts( void ) {
+#if USE_REF == REF_GL
cl_railtrail_type = Cvar_Get( "cl_railtrail_type", "0", 0 );
cl_railtrail_time = Cvar_Get( "cl_railtrail_time", "1.0", 0 );
cl_railcore_color = Cvar_Get( "cl_railcore_color", "red", 0 );
@@ -1534,7 +1540,6 @@ void CL_InitTEnts( void ) {
cl_railspiral_color->generator = Com_Color_g;
cl_railspiral_color_changed( cl_railspiral_color );
cl_railspiral_radius = Cvar_Get( "cl_railspiral_radius", "3", 0 );
+#endif
}
-
-
diff --git a/source/cl_view.c b/source/cl_view.c
index 32a128e..3f23320 100644
--- a/source/cl_view.c
+++ b/source/cl_view.c
@@ -109,6 +109,16 @@ void V_AddLight (vec3_t org, float intensity, float r, float g, float b) {
return;
dl = &r_dlights[r_numdlights++];
VectorCopy (org, dl->origin);
+#if USE_REF == REF_SOFT
+ // negative light in softwaref. only black allowed
+ if( r < 0 || g < 0 || b < 0 ) {
+ dl->intensity = -intensity;
+ dl->color[0] = 1;
+ dl->color[1] = 1;
+ dl->color[2] = 1;
+ return;
+ }
+#endif
dl->intensity = intensity;
dl->color[0] = r;
dl->color[1] = g;
diff --git a/source/ui_atoms.c b/source/ui_atoms.c
index 0065e41..2bbfffd 100644
--- a/source/ui_atoms.c
+++ b/source/ui_atoms.c
@@ -93,20 +93,20 @@ void UI_PushMenu( menuFrameWork_t *menu ) {
void UI_Resize( void ) {
int i;
- if( uis.glconfig.renderer == GL_RENDERER_SOFTWARE ) {
- uis.clipRect.left = 0;
- uis.clipRect.top = 0;
- uis.clipRect.right = uis.glconfig.vidWidth;
- uis.clipRect.bottom = uis.glconfig.vidHeight;
- uis.scale = 1;
- uis.width = uis.glconfig.vidWidth;
- uis.height = uis.glconfig.vidHeight;
- } else {
- Cvar_ClampValue( ui_scale, 1, 9 );
- uis.scale = 1 / ui_scale->value;
- uis.width = uis.glconfig.vidWidth * uis.scale;
- uis.height = uis.glconfig.vidHeight * uis.scale;
- }
+#if USE_REF == REF_SOFT
+ uis.clipRect.left = 0;
+ uis.clipRect.top = 0;
+ uis.clipRect.right = uis.glconfig.vidWidth;
+ uis.clipRect.bottom = uis.glconfig.vidHeight;
+ uis.scale = 1;
+ uis.width = uis.glconfig.vidWidth;
+ uis.height = uis.glconfig.vidHeight;
+#else
+ Cvar_ClampValue( ui_scale, 1, 9 );
+ uis.scale = 1 / ui_scale->value;
+ uis.width = uis.glconfig.vidWidth * uis.scale;
+ uis.height = uis.glconfig.vidHeight * uis.scale;
+#endif
for( i = 0; i < uis.menuDepth; i++ ) {
Menu_Init( uis.layers[i] );
@@ -433,11 +433,11 @@ void UI_Draw( int realtime ) {
}
R_SetColor( DRAW_COLOR_CLEAR, NULL );
- if( uis.glconfig.renderer == GL_RENDERER_SOFTWARE ) {
- R_SetClipRect( DRAW_CLIP_MASK, &uis.clipRect );
- } else {
- R_SetScale( &uis.scale );
- }
+#if USE_REF == REF_SOFT
+ R_SetClipRect( DRAW_CLIP_MASK, &uis.clipRect );
+#else
+ R_SetScale( &uis.scale );
+#endif
if( !uis.transparent ) {
// draw top menu
@@ -476,11 +476,11 @@ void UI_Draw( int realtime ) {
S_StartLocalSound( "misc/menu1.wav" );
}
- if( uis.glconfig.renderer == GL_RENDERER_SOFTWARE ) {
- R_SetClipRect( DRAW_CLIP_DISABLED, NULL );
- } else {
- R_SetScale( NULL );
- }
+#if USE_REF == REF_SOFT
+ R_SetClipRect( DRAW_CLIP_DISABLED, NULL );
+#else
+ R_SetScale( NULL );
+#endif
R_SetColor( DRAW_COLOR_CLEAR, NULL );
}
diff --git a/source/ui_menu.c b/source/ui_menu.c
index 3bc3c4b..c99b3a2 100644
--- a/source/ui_menu.c
+++ b/source/ui_menu.c
@@ -966,15 +966,13 @@ static void MenuList_DrawString( int x, int y, int flags,
R_SetClipRect( DRAW_CLIP_RIGHT|DRAW_CLIP_LEFT, &rc );
UI_DrawString( x, y + 1, NULL, column->uiFlags | flags, string );
- if( uis.glconfig.renderer == GL_RENDERER_SOFTWARE ) {
- R_SetClipRect( DRAW_CLIP_MASK, &uis.clipRect );
- } else {
- R_SetClipRect( DRAW_CLIP_DISABLED, NULL );
- }
+#if USE_REF == REF_SOFT
+ R_SetClipRect( DRAW_CLIP_MASK, &uis.clipRect );
+#else
+ R_SetClipRect( DRAW_CLIP_DISABLED, NULL );
+#endif
}
-
-
/*
=================
MenuList_Draw