Added borderless window support.

Added UI changes for renaming cl_screen.c->SCR_AdjustFrom640() to SCR_ScaleCoords().
Syntax cleanup in some client particle code.
Simplified Zaero visor HUD scaling hack with strncmp().
This commit is contained in:
Knightmare66 2021-07-20 00:21:05 -04:00
parent 263161d9fc
commit 9912c694d0
14 changed files with 222 additions and 145 deletions

View file

@ -67,7 +67,7 @@ CL_LightningBeam
size, 0,
particle_beam,
PART_BEAM,
NULL,0);
NULL, false);
}
break;
@ -87,7 +87,7 @@ CL_LightningBeam
size, 0,
particle_lightning,
PART_LIGHTNING,
NULL,0);
NULL, false);
p->src_ent=srcEnt;
p->dst_ent=dstEnt;
@ -103,7 +103,7 @@ CL_LightningBeam
size, 0,
particle_beam,
PART_BEAM,
NULL,0);
NULL, false);
}*/
void CL_LightningBeam (vec3_t start, vec3_t end, int srcEnt, int dstEnt, float size)
{
@ -331,7 +331,7 @@ void CL_Explosion_FlashParticle (vec3_t org, float size, qboolean large)
//100-(!rocket)?50:0, -10,
particle_rflash,
PART_DEPTHHACK_SHORT,
NULL,0);
NULL, false);
}
else
{
@ -348,7 +348,7 @@ void CL_Explosion_FlashParticle (vec3_t org, float size, qboolean large)
//100-(!rocket)?50:0, -10,
particle_blaster,
0,
NULL,0);
NULL, false);
}
}
@ -580,7 +580,7 @@ void CL_BloodSmack (vec3_t org, vec3_t dir)
10, 0,
particle_redblood,
PART_SHADED|PART_OVERBRIGHT,
CL_ParticleRotateThink,true);
CL_ParticleRotateThink, true);
CL_BloodPuff(org, dir, 1);
}
@ -618,7 +618,7 @@ void CL_BloodBleed (vec3_t org, vec3_t dir, int count)
MAXBLEEDSIZE*0.5, 0,
particle_blooddrip,
PART_SHADED|PART_DIRECTION|PART_GRAVITY|PART_OVERBRIGHT,
CL_ParticleBloodDropThink,true);
CL_ParticleBloodDropThink, true);
if (p && i == 0 && random() < BLOOD_DECAL_CHANCE)
p->flags |= PART_LEAVEMARK;
@ -652,7 +652,7 @@ void CL_BloodPuff (vec3_t org, vec3_t dir, int count)
10, 0,
particle_blood,
PART_SHADED,
CL_ParticleBloodPuffThink,true);
CL_ParticleBloodPuffThink, true);
if (p && i == 0 && random() < BLOOD_DECAL_CHANCE)
p->flags |= PART_LEAVEMARK;
@ -709,7 +709,7 @@ void CL_GreenBloodHit (vec3_t org, vec3_t dir)
10, 0,
particle_blood,
PART_SHADED|PART_OVERBRIGHT,
CL_ParticleBloodPuffThink,true);
CL_ParticleBloodPuffThink, true);
if (p && i == 0 && random() < BLOOD_DECAL_CHANCE)
p->flags |= PART_LEAVEMARK;
@ -745,7 +745,7 @@ void CL_ParticleEffect (vec3_t org, vec3_t dir, int color8, int count)
1, 0,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -777,7 +777,7 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color8, int count)
1, 0,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -873,7 +873,7 @@ void CL_ParticleEffectSplash (vec3_t org, vec3_t dir, int color8, int count)
5, -7,
particle_smoke,
PART_GRAVITY|PART_DIRECTION /*|PART_TRANS|PART_SHADED*/,
CL_ParticleSplashThink,true);
CL_ParticleSplashThink, true);
}
}
@ -928,7 +928,7 @@ void CL_ParticleEffectSparks (vec3_t org, vec3_t dir, vec3_t color, int count)
4, 0, //Knightmare- increase size
particle_solid,
PART_GRAVITY|PART_SPARK,
CL_ParticleSparksThink,true);
CL_ParticleSparksThink, true);
}
if (p) // added light effect
CL_AddParticleLight (p, (count>8)?130:65, 0, color[0]/255, color[1]/255, color[2]/255);
@ -1188,7 +1188,7 @@ void CL_TeleporterParticles (entity_state_t *ent)
2, 0,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -1236,7 +1236,7 @@ void CL_LogoutEffect (vec3_t org, int type)
1, 0,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -1264,7 +1264,7 @@ void CL_ItemRespawnParticles (vec3_t org)
1, 0,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -1300,7 +1300,7 @@ void CL_BigTeleportParticles (vec3_t org)
5, 0.15 / (0.5 + frand()*0.3), // was 2, 0.05
particle_generic,
0,
NULL,0);
NULL, false);
}
}
@ -1385,7 +1385,7 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir, int count, float size,
size, size*-0.125, // was 4, -0.5
particle_generic,
PART_GRAVITY,
CL_ParticleBlasterThink,true);
CL_ParticleBlasterThink, true);
/* d = rand()&5;
p = CL_SetupParticle (
@ -1400,7 +1400,7 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir, int count, float size,
4, -1.0,
particle_generic,
PART_GRAVITY,
CL_ParticleBlasterThink,true);*/
CL_ParticleBlasterThink, true);*/
}
if (p) // added light effect
CL_AddParticleLight (p, 150, 0, ((float)red)/255, ((float)green)/255, ((float)blue)/255);
@ -1446,7 +1446,7 @@ void CL_BlasterTrail (vec3_t start, vec3_t end, int red, int green, int blue,
3, -7, // was 4, -6;
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -1492,7 +1492,7 @@ void CL_HyperBlasterGlow (vec3_t start, vec3_t end, int red, int green, int blue
size, 0, // was 3, -36; 5, -60
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -1531,7 +1531,7 @@ void CL_HyperBlasterTrail (vec3_t start, vec3_t end, int red, int green, int blu
5, -60, // was 3, -36
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -1564,7 +1564,7 @@ void CL_BlasterTracer (vec3_t origin, vec3_t angle, int red, int green, int blue
size, 0,
particle_blasterblob, // was particle_generic
PART_DIRECTION|PART_INSTANT|PART_OVERBRIGHT,
NULL,0);
NULL, false);
}
void CL_HyperBlasterEffect (vec3_t start, vec3_t end, vec3_t angle, int red, int green, int blue,
@ -1612,7 +1612,7 @@ void CL_QuadTrail (vec3_t start, vec3_t end)
1, 0,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -1654,7 +1654,7 @@ void CL_FlagTrail (vec3_t start, vec3_t end, qboolean isred, qboolean isgreen)
1, 0,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -1758,8 +1758,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
3 + random()*2, 0,
particle_blooddrop,
PART_OVERBRIGHT|PART_GRAVITY|PART_SHADED,
CL_ParticleBloodThink,true);
//NULL,0);
CL_ParticleBloodThink, true);
else
p = CL_SetupParticle (
0, 0, 0,
@ -1773,8 +1772,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
5, -1,
particle_blood,
PART_GRAVITY|PART_SHADED,
CL_ParticleBloodThink,true);
//NULL,0);
CL_ParticleBloodThink, true);
if ( p && (crand() < (double)0.0001F) )
p->flags |= PART_LEAVEMARK;
}
@ -1792,8 +1790,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
5, -1,
particle_blood,
PART_OVERBRIGHT|PART_GRAVITY|PART_SHADED,
CL_ParticleBloodThink,true);
//NULL,0);
CL_ParticleBloodThink, true);
if ( p && (crand() < (double)0.0001F) )
p->flags |= PART_LEAVEMARK;
@ -1813,7 +1810,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
1+random()*3, 1,
particle_bubble,
PART_TRANS|PART_SHADED,
CL_ExplosionBubbleThink,true);
CL_ExplosionBubbleThink, true);
else
CL_SetupParticle (
crand()*180, crand()*50, 0,
@ -1827,7 +1824,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
5, 5,
particle_smoke,
PART_TRANS|PART_SHADED,
CL_ParticleRotateThink,true);
CL_ParticleRotateThink, true);
}
else
{
@ -1843,7 +1840,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
5, 5,
particle_smoke,
PART_OVERBRIGHT|PART_TRANS|PART_SHADED,
CL_ParticleRotateThink,true);
CL_ParticleRotateThink, true);
}
}
@ -1902,7 +1899,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old)
2, -2,
particle_blaster,
PART_GRAVITY,
NULL,0);
NULL, false);
}
VectorAdd (move, vec, move);
}
@ -1996,7 +1993,7 @@ void CL_RailSprial (vec3_t start, vec3_t end, int red, int green, int blue)
3, 0,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2081,7 +2078,7 @@ void CL_DevRailTrail (vec3_t start, vec3_t end, int red, int green, int blue)
dec*DEVRAILSTEPS*TWOTHIRDS, 0,
particle_beam2,
PART_DIRECTION,
NULL,0);
NULL, false);
}
CL_SetupParticle (
@ -2096,7 +2093,7 @@ void CL_DevRailTrail (vec3_t start, vec3_t end, int red, int green, int blue)
2, -0.25,
particle_solid,
PART_GRAVITY|PART_SPARK,
CL_ParticleDevRailThink,true);
CL_ParticleDevRailThink, true);
CL_SetupParticle (
crand()*180, crand()*100, 0,
@ -2184,7 +2181,7 @@ void CL_RailTrail (vec3_t start, vec3_t end, int red, int green, int blue)
RAILTRAILSPACE*TWOTHIRDS, (colored)?0:-5,
particle_beam2,
PART_BEAM,
NULL,0);
NULL, false);
}
if ( !colored ) {
CL_RailSprial (start, end, red, green, blue);
@ -2232,7 +2229,7 @@ void CL_IonripperTrail (vec3_t start, vec3_t ent)
3, 0, // was dec
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2276,7 +2273,7 @@ void CL_BubbleTrail (vec3_t start, vec3_t end)
size, 1,
particle_bubble,
PART_TRANS|PART_SHADED,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2343,7 +2340,7 @@ void CL_FlyParticles (vec3_t origin, int count)
1+sin(i+ltime), 1,
particle_generic,
PART_TRANS,
NULL,0);
NULL, false);
}
}
@ -2509,7 +2506,7 @@ void CL_TrapParticles (entity_t *ent)
3, -3,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2549,7 +2546,7 @@ void CL_TrapParticles (entity_t *ent)
1, 1,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -2580,7 +2577,7 @@ void CL_BFGExplosionParticles (vec3_t org)
10, -10,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -2619,7 +2616,7 @@ void CL_TeleportParticles (vec3_t org)
1, 3,
particle_generic,
PART_GRAVITY,
NULL,0);
NULL, false);
}
}
@ -2703,7 +2700,7 @@ void CL_DebugTrail (vec3_t start, vec3_t end)
7.5, 0,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2746,7 +2743,7 @@ void CL_ForceWall (vec3_t start, vec3_t end, int color8)
5, 0,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2788,7 +2785,7 @@ void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist)
size, 1,
particle_bubble,
PART_TRANS|PART_SHADED,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -2891,7 +2888,7 @@ void CL_HeatbeamParticles (vec3_t start, vec3_t forward)
size, 1, // shrunk size
particle_blaster,
0,
NULL,0);
NULL, false);
}
VectorAdd (move, vec, move);
}
@ -2933,7 +2930,7 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int red, int green, int blu
4, -2,
particle_smoke,
0,
NULL,0);
NULL, false);
if (!p)
return;
@ -2985,7 +2982,7 @@ void CL_ParticleSteamEffect2 (cl_sustain_t *self)
4, 0,
particle_smoke,
PART_GRAVITY,
NULL,0);
NULL, false);
if (!p)
return;
@ -3043,7 +3040,7 @@ void CL_TrackerTrail (vec3_t start, vec3_t end)
2, 0,
particle_generic,
PART_TRANS,
NULL,0);
NULL, false);
if (!p)
return;
@ -3081,7 +3078,7 @@ void CL_Tracker_Shell (vec3_t origin)
1, 0, //Knightmare- changed size
particle_generic,
PART_TRANS,
NULL,0);
NULL, false);
if (!p)
return;
@ -3120,7 +3117,7 @@ void CL_MonsterPlasma_Shell(vec3_t origin)
2, 0,
particle_generic,
PART_TRANS|PART_INSTANT,
NULL,0);
NULL, false);
if (!p)
return;
@ -3168,7 +3165,7 @@ void CL_Widowbeamout (cl_sustain_t *self)
2, 0,
particle_generic,
PART_TRANS|PART_INSTANT,
NULL,0);
NULL, false);
if (!p)
return;
@ -3217,7 +3214,7 @@ void CL_Nukeblast (cl_sustain_t *self)
10*(0.5+ratio*0.5), -1,
particle_generic,
PART_INSTANT,
NULL,0);
NULL, false);
if (!p)
return;
@ -3261,7 +3258,7 @@ void CL_WidowSplash (vec3_t org)
3, 0,
particle_generic,
0,
NULL,0);
NULL, false);
if (!p)
return;
@ -3301,7 +3298,7 @@ void CL_Tracker_Explode (vec3_t origin)
2, 0,
particle_generic,
PART_TRANS,
NULL,0);
NULL, false);
if (!p)
return;
@ -3356,7 +3353,7 @@ void CL_TagTrail (vec3_t start, vec3_t end, int color8)
1.5, 0,
particle_generic,
0,
NULL,0);
NULL, false);
VectorAdd (move, vec, move);
}
@ -3387,7 +3384,7 @@ void CL_ColorExplosionParticles (vec3_t org, int color8, int run)
2, 1,
particle_generic,
0,
NULL,0);
NULL, false);
}
}
@ -3414,7 +3411,7 @@ void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, float size)
size, 5,
particle_smoke,
PART_TRANS|PART_SHADED|PART_OVERBRIGHT,
CL_ParticleRotateThink,true);
CL_ParticleRotateThink, true);
}

View file

@ -802,7 +802,7 @@ void CL_DrawLayout (void)
return;
// Special hack for visor HUD addition in Zaero
if ( strstr(cl.layout, "xv 26 yb -75 string \"Tracking ") )
if ( strncmp(cl.layout, "xv 26 yb -75 string \"Tracking ", 30) == 0 )
isStatusBar = true;
CL_ExecuteLayoutString (cl.layout, isStatusBar);

View file

@ -318,52 +318,52 @@ cparticle_t *CL_SetupParticle (
p->time = cl.time;
p->angle[0]=angle0;
p->angle[1]=angle1;
p->angle[2]=angle2;
p->angle[0] = angle0;
p->angle[1] = angle1;
p->angle[2] = angle2;
p->org[0]=org0;
p->org[1]=org1;
p->org[2]=org2;
p->oldorg[0]=org0;
p->oldorg[1]=org1;
p->oldorg[2]=org2;
p->org[0] = org0;
p->org[1] = org1;
p->org[2] = org2;
p->oldorg[0] = org0;
p->oldorg[1] = org1;
p->oldorg[2] = org2;
p->vel[0]=vel0;
p->vel[1]=vel1;
p->vel[2]=vel2;
p->vel[0] = vel0;
p->vel[1] = vel1;
p->vel[2] = vel2;
p->accel[0]=accel0;
p->accel[1]=accel1;
p->accel[2]=accel2;
p->accel[0] = accel0;
p->accel[1] = accel1;
p->accel[2] = accel2;
p->color[0]=color0;
p->color[1]=color1;
p->color[2]=color2;
p->color[0] = color0;
p->color[1] = color1;
p->color[2] = color2;
p->colorvel[0]=colorvel0;
p->colorvel[1]=colorvel1;
p->colorvel[2]=colorvel2;
p->colorvel[0] = colorvel0;
p->colorvel[1] = colorvel1;
p->colorvel[2] = colorvel2;
p->blendfunc_src = blendfunc_src;
p->blendfunc_dst = blendfunc_dst;
p->alpha=alpha;
p->alphavel=alphavel;
p->size=size;
p->sizevel=sizevel;
p->alpha = alpha;
p->alphavel = alphavel;
p->size = size;
p->sizevel = sizevel;
p->image=image;
p->flags=flags;
p->image = image;
p->flags = flags;
p->src_ent=0;
p->dst_ent=0;
p->src_ent = 0;
p->dst_ent = 0;
if (think)
p->think = think;
else
p->think = NULL;
p->thinknext=thinknext;
p->thinknext = thinknext;
for (j=0;j<P_LIGHTS_MAX;j++)
{

View file

@ -1,13 +1,16 @@
------------------------------------
Changes as of v0.20 update 8:
------------------------------------
- Added 3840x1600 and 4096x2160 video modes.
- Added 160Hz, 165Hz, 180Hz, and 240Hz refresh rates.
- Added automatic setting of r_maxfps based on refresh rate set in video menu (r_displayrefresh).
This can be disabled by setting the cvar r_maxfps_autoset to 0.
- Removed the old, decrepit single-texturing surface rendering mode. GL_ARB_multitexture support is now required.
- Added borderless window support. Set vid_fullscreen to 2 to select borderless window.
- Added support for triple-monitor surround modes via custom resolutions. Monitors must be bound as a single logical display.
Keeps all menu/HUD elements on the center screen, set the cvar scr_surroundlayout to 0 to disable this.

View file

@ -129,11 +129,21 @@ typedef enum
rserr_ok,
rserr_invalid_fullscreen,
rserr_invalid_borderless, // borderless support
rserr_invalid_mode,
rserr_unknown
} rserr_t;
// borderless support
typedef enum
{
dt_windowed = 0,
dt_fullscreen = 1,
dt_borderless = 2
} dispType_t;
#include "r_model.h"
void GL_BeginRendering (int *x, int *y, int *width, int *height);
@ -1049,12 +1059,12 @@ IMPLEMENTATION SPECIFIC FUNCTIONS
====================================================================
*/
void GLimp_BeginFrame( float camera_separation );
void GLimp_EndFrame( void );
int GLimp_Init( void *hinstance, void *hWnd );
void GLimp_Shutdown( void );
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen );
void GLimp_AppActivate( qboolean active );
void GLimp_EnableLogging( qboolean enable );
void GLimp_LogNewFrame( void );
void GLimp_BeginFrame (float camera_separation);
void GLimp_EndFrame (void);
int GLimp_Init (void *hinstance, void *hWnd);
void GLimp_Shutdown (void);
//int GLimp_SetMode (int *pwidth, int *pheight, int mode, qboolean fullscreen);
int GLimp_SetMode (int *pwidth, int *pheight, int mode, dispType_t fullscreen); // borderless support
void GLimp_AppActivate (qboolean active);
void GLimp_EnableLogging (qboolean enable);
void GLimp_LogNewFrame (void);

View file

@ -1203,7 +1203,8 @@ void R_Register (void)
Cvar_SetDescription ("r_3dlabs_broken", "Enables CDS hack for broken 3DLabs drivers.");
vid_fullscreen = Cvar_Get( "vid_fullscreen", "1", CVAR_ARCHIVE );
Cvar_SetDescription ("vid_fullscreen", "Enables fullscreen video mode.");
// Cvar_SetDescription ("vid_fullscreen", "Enables fullscreen video mode.");
Cvar_SetDescription ("vid_fullscreen", "Sets fullscreen or borderless video mode. 0 = windowed, 1 = fullscreen, 2 = borderless"); // borderless support
vid_gamma = Cvar_Get( "vid_gamma", "0.8", CVAR_ARCHIVE ); // was 1.0
Cvar_SetDescription ("vid_gamma", "Screen brightness value. Uses inverse scale.");
vid_ref = Cvar_Get( "vid_ref", "gl", CVAR_ARCHIVE );
@ -1258,7 +1259,8 @@ R_SetMode
qboolean R_SetMode (void)
{
rserr_t err;
qboolean fullscreen;
// qboolean fullscreen;
dispType_t fullscreen; // borderless support
if ( vid_fullscreen->modified && !glConfig.allowCDS )
{
@ -1288,7 +1290,16 @@ qboolean R_SetMode (void)
Cvar_SetValue( "vid_fullscreen", 0);
vid_fullscreen->modified = false;
VID_Printf (PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n" );
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, r_mode->integer, false ) ) == rserr_ok )
// if ( ( err = GLimp_SetMode( &vid.width, &vid.height, r_mode->integer, false ) ) == rserr_ok )
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, r_mode->integer, dt_windowed ) ) == rserr_ok )
return true;
}
else if ( err == rserr_invalid_borderless ) // borderless support
{
Cvar_SetValue( "vid_fullscreen", 0);
vid_fullscreen->modified = false;
VID_Printf (PRINT_ALL, "R_SetMode() - borderless window unavailable in this mode\n" );
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, r_mode->integer, dt_windowed ) ) == rserr_ok )
return true;
}
else if ( err == rserr_invalid_mode )
@ -1299,7 +1310,8 @@ qboolean R_SetMode (void)
}
// try setting it back to something safe
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, glState.prev_mode, false ) ) != rserr_ok )
// if ( ( err = GLimp_SetMode( &vid.width, &vid.height, glState.prev_mode, false ) ) != rserr_ok )
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, glState.prev_mode, dt_windowed ) ) != rserr_ok )
{
VID_Printf (PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n" );
return false;

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "r_local.h"
#if USE_SINGLETEXTURE_MODE
#ifdef USE_SINGLETEXTURE_MODE
/*
================

View file

@ -707,7 +707,7 @@ void Menu_Draw (menuframework_s *menu)
x1 = menu->x + item->x + RCOLUMN_OFFSET; // + 2 chars for space + cursor
y1 = menu->y + item->y;
w1 = 0; h1 = item->textSize; // MENU_FONT_SIZE
SCR_AdjustFrom640 (&x1, &y1, &w1, &h1, ALIGN_CENTER);
SCR_ScaleCoords (&x1, &y1, &w1, &h1, ALIGN_CENTER);
min[0] = x1; max[0] = x1+w1;
min[1] = y1; max[1] = y1+h1;
// max[0] = min[0] = SCR_ScaledScreen(menu->x + item->x + RCOLUMN_OFFSET); //+ 2 chars for space + cursor
@ -1119,7 +1119,7 @@ int NewSliderValueForX (int x, menuslider_s *s)
int pos;
sliderbase = s->generic.x + s->generic.parent->x + MENU_FONT_SIZE + RCOLUMN_OFFSET;
SCR_AdjustFrom640 (&sliderbase, NULL, NULL, NULL, ALIGN_CENTER);
SCR_ScaleCoords (&sliderbase, NULL, NULL, NULL, ALIGN_CENTER);
pos = x - sliderbase;
// pos = x - SCR_ScaledScreen(s->generic.x + s->generic.parent->x + MENU_FONT_SIZE + RCOLUMN_OFFSET);
@ -1173,7 +1173,7 @@ void Menu_ClickSlideItem (menuframework_s *menu, void *menuitem)
x = menu->x + item->x + Slider_CursorPositionX(slider) - 4;
w = 8;
SCR_AdjustFrom640 (&x, NULL, &w, NULL, ALIGN_CENTER);
SCR_ScaleCoords (&x, NULL, &w, NULL, ALIGN_CENTER);
min = x; max = x + w;
if (cursor.x < min)

View file

@ -136,7 +136,7 @@ void UI_DrawMainCursor3D (int x, int y)
// size 24x34
rx = x; ry = y;
rw = 24; rh = 34;
SCR_AdjustFrom640 (&rx, &ry, &rw, &rh, ALIGN_CENTER);
SCR_ScaleCoords (&rx, &ry, &rw, &rh, ALIGN_CENTER);
refdef.x = rx; refdef.y = ry;
refdef.width = rw; refdef.height = rh;
refdef.fov_x = 40;

View file

@ -350,7 +350,7 @@ qboolean PlayerConfig_CheckIncerement (int dir, float x, float y, float w, float
char *sound = NULL;
x1 = x; y1 = y; w1 = w; h1 = h;
SCR_AdjustFrom640 (&x1, &y1, &w1, &h1, ALIGN_CENTER);
SCR_ScaleCoords (&x1, &y1, &w1, &h1, ALIGN_CENTER);
min[0] = x1; max[0] = x1 + w1;
min[1] = y1; max[1] = y1 + h1;
@ -478,7 +478,7 @@ void PlayerConfig_DrawSkinSelection (void)
SCR_DrawFill (icon_x-3, icon_y-3, NUM_SKINBOX_ITEMS*34+4, 38, ALIGN_CENTER, 0,0,0,255);
if (R_DrawFindPic("/gfx/ui/listbox_background.pcx")) {
x = icon_x-2; y = icon_y-2; w = NUM_SKINBOX_ITEMS*34+2; h = 36;
SCR_AdjustFrom640 (&x, &y, &w, &h, ALIGN_CENTER);
SCR_ScaleCoords (&x, &y, &w, &h, ALIGN_CENTER);
R_DrawTileClear ((int)x, (int)y, (int)w, (int)h, "/gfx/ui/listbox_background.pcx");
}
else
@ -521,7 +521,7 @@ void PlayerConfig_MenuDraw (void)
rx = 0; ry = 0;
rw = SCREEN_WIDTH; rh = SCREEN_HEIGHT;
SCR_AdjustFrom640 (&rx, &ry, &rw, &rh, ALIGN_CENTER);
SCR_ScaleCoords (&rx, &ry, &rw, &rh, ALIGN_CENTER);
refdef.x = rx; refdef.y = ry;
refdef.width = rw; refdef.height = rh;
refdef.fov_x = 50;

View file

@ -74,7 +74,7 @@ void UI_AddButton (buttonmenuobject_t *thisObj, int index, float x, float y, flo
float x1, y1, w1, h1;
x1 = x; y1 = y; w1 = w; h1 = h;
SCR_AdjustFrom640 (&x1, &y1, &w1, &h1, ALIGN_CENTER);
SCR_ScaleCoords (&x1, &y1, &w1, &h1, ALIGN_CENTER);
thisObj->min[0] = x1; thisObj->max[0] = x1 + w1;
thisObj->min[1] = y1; thisObj->max[1] = y1 + h1;
thisObj->index = index;
@ -95,7 +95,7 @@ void UI_AddMainButton (mainmenuobject_t *thisObj, int index, int x, int y, char
R_DrawGetPicSize (&w, &h, name);
x1 = x; y1 = y; w1 = w; h1 = h;
SCR_AdjustFrom640 (&x1, &y1, &w1, &h1, ALIGN_CENTER);
SCR_ScaleCoords (&x1, &y1, &w1, &h1, ALIGN_CENTER);
thisObj->min[0] = x1; thisObj->max[0] = x1 + w1;
thisObj->min[1] = y1; thisObj->max[1] = y1 + h1;

View file

@ -389,11 +389,17 @@ Menu_Video_Init
*/
void Menu_Video_Init (void)
{
// Knightmare- added 1280x1024, 1400x1050, 856x480, 1024x480 modes, removed 320x240, 400x300, 512x384 modes
static const char *resolutions[] =
{
#include "../qcommon/vid_resolutions.h"
};
static const char *fullscreen_names[] =
{
"windowed",
"fullscreen",
"borderless",
0
};
static const char *refreshrate_names[] =
{
"[default]",
@ -501,10 +507,11 @@ void Menu_Video_Init (void)
s_fs_box.generic.textSize = MENU_FONT_SIZE;
s_fs_box.generic.x = 0;
s_fs_box.generic.y = y += 3.5*MENU_LINE_SIZE;
s_fs_box.generic.name = "fullscreen";
s_fs_box.itemnames = yesno_names;
s_fs_box.generic.name = "display type"; // "fullscreen"
s_fs_box.itemnames = fullscreen_names; // yesno_names
s_fs_box.curvalue = Cvar_VariableValue("vid_fullscreen");
s_fs_box.generic.statusbar = "changes bettween fullscreen and windowed display";
// s_fs_box.generic.statusbar = "changes bettween fullscreen and windowed display";
s_fs_box.generic.statusbar = "changes bettween fullscreen, borderless window, and windowed display";
s_brightness_slider.generic.type = MTYPE_SLIDER;
s_brightness_slider.generic.textSize = MENU_FONT_SIZE;

View file

@ -206,7 +206,8 @@ static qboolean VerifyDriver( void )
#define WINDOW_CLASS_NAME2 "KMQuake2 - The Reckoning" // changed
#define WINDOW_CLASS_NAME3 "KMQuake2 - Ground Zero" // changed
qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
//qboolean VID_CreateWindow (int width, int height, qboolean fullscreen)
qboolean VID_CreateWindow (int width, int height, dispType_t fullscreen)
{
WNDCLASS wc;
RECT r;
@ -222,13 +223,13 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
wc.cbWndExtra = 0;
wc.hInstance = glw_state.hInstance;
if (FS_ModType("xatrix")) { // q2mp1
if (FS_ModType("xatrix")) { // The Reckoning
wc.hIcon = LoadIcon(glw_state.hInstance, MAKEINTRESOURCE(IDI_ICON2));
//wc.lpszClassName = WINDOW_CLASS_NAME2;
// wc.lpszClassName = WINDOW_CLASS_NAME2;
}
else if (FS_ModType("rogue")) { // q2mp2
else if (FS_ModType("rogue")) { // Ground Zero
wc.hIcon = LoadIcon(glw_state.hInstance, MAKEINTRESOURCE(IDI_ICON3));
//wc.lpszClassName = WINDOW_CLASS_NAME3;
// wc.lpszClassName = WINDOW_CLASS_NAME3;
}
else {
wc.hIcon = LoadIcon(glw_state.hInstance, MAKEINTRESOURCE(IDI_ICON1));
@ -242,16 +243,22 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
if (!RegisterClass (&wc) )
VID_Error (ERR_FATAL, "Couldn't register window class");
if (fullscreen)
// if (fullscreen)
if ( fullscreen == dt_fullscreen ) // borderless support
{
exstyle = WS_EX_TOPMOST;
//stylebits = WS_POPUP|WS_VISIBLE;
// stylebits = WS_POPUP|WS_VISIBLE;
stylebits = WS_POPUP|WS_SYSMENU|WS_VISIBLE;
}
else
else if ( fullscreen == dt_borderless ) // borderless support
{
exstyle = 0;
//stylebits = WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE;
stylebits = WS_POPUP|WS_VISIBLE;
}
else // if ( fullscreen == dt_windowed )
{
exstyle = 0;
// stylebits = WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE;
stylebits = WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_SYSMENU|WS_VISIBLE;
}
@ -265,12 +272,33 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
w = r.right - r.left;
h = r.bottom - r.top;
if (fullscreen)
// if (fullscreen)
if ( fullscreen == dt_fullscreen ) // borderless support
{
x = 0;
y = 0;
}
else
else if ( fullscreen == dt_borderless ) // borderless support
{
HDC hDC;
int hRes, vRes;
hDC = GetDC (NULL);
hRes = GetDeviceCaps (hDC, HORZRES);
vRes = GetDeviceCaps (hDC, VERTRES);
ReleaseDC (0, hDC);
if (hRes <= vid.width)
x = 0;
else
x = (hRes - vid.width) / 2;
if (vRes <= vid.height)
y = 0;
else
y = (vRes - vid.height) / 2;
}
else // if ( fullscreen == dt_windowed )
{
vid_xpos = Cvar_Get ("vid_xpos", "0", 0);
vid_ypos = Cvar_Get ("vid_ypos", "0", 0);
@ -315,10 +343,12 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
/*
** GLimp_SetMode
*/
rserr_t GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen )
//rserr_t GLimp_SetMode (int *pwidth, int *pheight, int mode, qboolean fullscreen)
rserr_t GLimp_SetMode (int *pwidth, int *pheight, int mode, dispType_t fullscreen)
{
int width, height;
const char *win_fs[] = { "W", "FS" };
// const char *win_fs[] = { "W", "FS" };
const char *win_fs[] = { "W", "FS", "BL" }; // borderless support
VID_Printf( PRINT_ALL, "Initializing OpenGL display\n");
@ -339,7 +369,8 @@ rserr_t GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen
}
// do a CDS if needed
if ( fullscreen )
// if ( fullscreen )
if ( fullscreen == dt_fullscreen ) // borderless support
{
DEVMODE fullscreenMode;
@ -426,14 +457,16 @@ rserr_t GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen
*pwidth = width;
*pheight = height;
glState.fullscreen = false;
if ( !VID_CreateWindow (width, height, false) )
// if ( !VID_CreateWindow (width, height, false) )
if ( !VID_CreateWindow (width, height, dt_windowed) )
return rserr_invalid_mode;
return rserr_invalid_fullscreen;
}
else
{
VID_Printf( PRINT_ALL, " ok\n" );
if ( !VID_CreateWindow (width, height, true) )
// if ( !VID_CreateWindow (width, height, true) )
if ( !VID_CreateWindow (width, height, dt_fullscreen) )
return rserr_invalid_mode;
glState.fullscreen = true;
@ -441,7 +474,19 @@ rserr_t GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen
}
}
}
else
else if ( fullscreen == dt_borderless ) // borderless support
{
VID_Printf( PRINT_ALL, "...setting borderless window mode\n" );
ChangeDisplaySettings( 0, 0 );
*pwidth = width;
*pheight = height;
glState.fullscreen = false;
if ( !VID_CreateWindow (width, height, dt_borderless) )
return rserr_invalid_borderless;
}
else // if ( fullscreen == dt_windowed )
{
VID_Printf( PRINT_ALL, "...setting windowed mode\n" );
@ -450,7 +495,8 @@ rserr_t GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen
*pwidth = width;
*pheight = height;
glState.fullscreen = false;
if ( !VID_CreateWindow (width, height, false) )
// if ( !VID_CreateWindow (width, height, false) )
if ( !VID_CreateWindow (width, height, dt_windowed) )
return rserr_invalid_mode;
}
@ -466,7 +512,7 @@ rserr_t GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen
** for the window. The state structure is also nulled out.
**
*/
void GLimp_Shutdown( void )
void GLimp_Shutdown (void)
{
// Knightmare- added Vic's hardware gamma ramp
ShutdownGammaRamp ();
@ -516,7 +562,7 @@ void GLimp_Shutdown( void )
** of OpenGL. Under Win32 this means dealing with the pixelformats and
** doing the wgl interface stuff.
*/
qboolean GLimp_Init( void *hinstance, void *wndproc )
qboolean GLimp_Init (void *hinstance, void *wndproc)
{
#define OSR2_BUILD_NUMBER 1111
@ -768,7 +814,7 @@ fail:
/*
** GLimp_BeginFrame
*/
void GLimp_BeginFrame( float camera_separation )
void GLimp_BeginFrame (float camera_separation)
{
if ( r_bitdepth->modified )
{
@ -820,7 +866,7 @@ void GLimp_EndFrame (void)
/*
** GLimp_AppActivate
*/
void GLimp_AppActivate( qboolean active )
void GLimp_AppActivate (qboolean active)
{
static qboolean desktop_restored;
cvar_t *restore_desktop = Cvar_Get( "win_alttab_restore_desktop", "1", CVAR_ARCHIVE );
@ -832,7 +878,8 @@ void GLimp_AppActivate( qboolean active )
ShowWindow( glw_state.hWnd, SW_RESTORE );
// Knightmare- restore desktop settings on alt-tabbing from fullscreen
if ( vid_fullscreen->integer && desktop_restored && glw_state.hGLRC != NULL )
// if ( vid_fullscreen->integer && desktop_restored && glw_state.hGLRC != NULL )
if ( (vid_fullscreen->integer == 1) && desktop_restored && glw_state.hGLRC != NULL ) // borderless support
{
int width, height;
DEVMODE fullscreenMode;

View file

@ -748,7 +748,8 @@ void VID_Init (void)
vid_ypos = Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE);
Cvar_SetDescription ("vid_ypos", "Sets vertical desktop position of window in windowed mode.");
vid_fullscreen = Cvar_Get ("vid_fullscreen", "1", CVAR_ARCHIVE);
Cvar_SetDescription ("vid_fullscreen", "Enables fullscreen video mode.");
// Cvar_SetDescription ("vid_fullscreen", "Enables fullscreen video mode.");
Cvar_SetDescription ("vid_fullscreen", "Sets fullscreen or borderless video mode. 0 = windowed, 1 = fullscreen, 2 = borderless"); // borderless support
vid_gamma = Cvar_Get( "vid_gamma", "0.8", CVAR_ARCHIVE ); // was 1.0
Cvar_SetDescription ("vid_gamma", "Screen brightness value. Uses inverse scale.");
win_noalttab = Cvar_Get( "win_noalttab", "0", CVAR_ARCHIVE );