.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 1 SDK (http://forums.bots-united.com/forumdisplay.php?f=33)
-   -   quake 2 screen effect (http://forums.bots-united.com/showthread.php?t=7668)

hl_backdoor 27-07-2010 03:32

quake 2 screen effect
 
Hello, I want to know something.. if you ever played quake 1 or 2, you can remember some functions that resize the screen. I think you had to press + or - to size up or down the screen. well in CS 1.6 I cannot do that at the moment, I did a search in google and found that some commands are disabled for the game now. I tried the commands sizeup and sizedown but they have no effect. anybody knows a way to get this functionality, programatically or by a working cvar or command? thank you

:batman:

Ancient 27-07-2010 06:15

Re: quake 2 screen effect
 
I remember Doom I and II had that effect.
But I think counter-strike disabled that so you would have to choose which resolution to pick rather than using sizeup or sizedown.

hl_backdoor 27-07-2010 20:50

Re: quake 2 screen effect
 
I did a quick search and found that the screen resizement is handled by some internal variables (cvars) ... I was looking into the quake2 source code since it is the basesrc for hl1 src code. I am 100% sure that this can be done in CS1.6 apart of those disabled commands (sizeup and down). so I still ask if anyone knows how this can be done. :)

Code:


vid_dll.c
// Global variables used internally by this module
viddef_t viddef;    // global video state; used by other modules

/*
** VID_NewWindow
*/
void VID_NewWindow ( int width, int height)
{
 viddef.width  = width;
 viddef.height = height;
 cl.force_refdef = true;  // can't use a paused refdef
}
/*
============
VID_Init
============
*/
void VID_Init (void)
{
 /* Create the video variables so we know how to start the graphics drivers */
 vid_ref = Cvar_Get ("vid_ref", "soft", CVAR_ARCHIVE);
 vid_xpos = Cvar_Get ("vid_xpos", "3", CVAR_ARCHIVE);
 vid_ypos = Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE);
 vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ARCHIVE);
 vid_gamma = Cvar_Get( "vid_gamma", "1", CVAR_ARCHIVE );
 win_noalttab = Cvar_Get( "win_noalttab", "0", CVAR_ARCHIVE );
 /* Add some console commands that we want to handle */
 Cmd_AddCommand ("vid_restart", VID_Restart_f);
 Cmd_AddCommand ("vid_front", VID_Front_f);
 /*
 ** this is a gross hack but necessary to clamp the mode for 3Dfx
 */
#if 0
 {
  cvar_t *gl_driver = Cvar_Get( "gl_driver", "opengl32", 0 );
  cvar_t *gl_mode = Cvar_Get( "gl_mode", "3", 0 );
  if ( stricmp( gl_driver->string, "3dfxgl" ) == 0 )
  {
  Cvar_SetValue( "gl_mode", 3 );
  viddef.width  = 640;
  viddef.height = 480;
  }
 }
#endif
 /* Disable the 3Dfx splash screen */
 putenv("FX_GLIDE_NO_SPLASH=0");
 
 /* Start the graphics mode and load refresh DLL */
 VID_CheckChanges();
}
 
/*////////////////////*/

cl_scrn.c
 

vrect_t  scr_vrect;  // position of render window on screen

cvar_t  *scr_viewsize;
 
/*
=================
SCR_CalcVrect
Sets scr_vrect, the coordinates of the rendered window
=================
*/
static void SCR_CalcVrect (void)
{
 int  size;
 // bound viewsize
 if (scr_viewsize->value < 40)
  Cvar_Set ("viewsize","40");
 if (scr_viewsize->value > 100)
  Cvar_Set ("viewsize","100");
 size = scr_viewsize->value;
 scr_vrect.width = viddef.width*size/100;
 scr_vrect.width &= ~7;
 scr_vrect.height = viddef.height*size/100;
 scr_vrect.height &= ~1;
 scr_vrect.x = (viddef.width - scr_vrect.width)/2;
 scr_vrect.y = (viddef.height - scr_vrect.height)/2;
}

/*
=================
SCR_SizeUp_f
Keybinding command
=================
*/
void SCR_SizeUp_f (void)
{
 Cvar_SetValue ("viewsize",scr_viewsize->value+10);
}

/*
=================
SCR_SizeDown_f
Keybinding command
=================
*/
void SCR_SizeDown_f (void)
{
 Cvar_SetValue ("viewsize",scr_viewsize->value-10);
}
 

/*
==================
SCR_Init
==================
*/
void SCR_Init (void)
{
 
        scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE);

//
// register our commands
//
 Cmd_AddCommand ("timerefresh",SCR_TimeRefresh_f);
 Cmd_AddCommand ("loading",SCR_Loading_f);
 Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
 Cmd_AddCommand ("sizedown",SCR_SizeDown_f);
 scr_initialized = true;
}
 
/*///////////////*/

/*
============
Cvar_Get
If the variable already exists, the value will not be set
The flags will be or'ed in if the variable exists.
============
*/
cvar_t *Cvar_Get (char *var_name, char *var_value, int flags);

/*
============
Cvar_SetValue
============
*/
void Cvar_SetValue (char *var_name, float value)
{
 char val[32];
 if (value == (int)value)
  Com_sprintf (val, sizeof(val), "%i",(int)value);
 else
  Com_sprintf (val, sizeof(val), "%f",value);
 Cvar_Set (var_name, val);
}



All times are GMT +2. The time now is 03:26.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.