Tutorial *86*

This tutorial is to make the console stretch in and out, instead of scrolling in and out. It's pretty simple code, some cvars to control it, and some code to make it stretch instead making it scroll. Anyway, on to the code:

First declare some cvars (to control the if the console should stretch or not). Open up gl_screen.c, and after:

cvar_t		gl_triplebuffer = {"gl_triplebuffer", "1", true };


cvar_t      scr_console_stretch = { "scr_console_stretch", "0" };

still in gl_screen.c, find the function SCR_Init, and after

Cvar_RegisterVariable (&gl_triplebuffer);

Finally, open screen.h, find the line below

extern cvar_t scr_viewsize;

and add this after it:

extern cvar_t scr_console_stretch;

Now we have some cvars to control the stretching, we need to write the code for the stretching.
To do that, open up gl_draw.c and search for the function Draw_ConsoleBackground().
In the Draw_Consolebackground function, find these lines:

 if (r_console_subdivide_y.value < 1)


        Cvar_SetValue("r_console_subdivide_y", 1);


and after them, add:

    if (scr_console_stretch.value) {

       y = 0;

       console.height = lines; //make it stretch


    else {

       y = lines - vid.height;

       console.height = vid.height;


That should be all, compile and run, type at the console scr_console_stretch 1, and move the console up and down a few times.
Now if you've done it right, it should stretch instead of scroll.

Sign up
[Remember Me]