Q3 style - Scaled Status Bar
This is one of those tutorials, that people either love or hate. if (scr_viewsize.value > 120) Cvar_Set ("viewsize","120"); // muff@yakko.globalnet.co.uk - this forces full screen mode in the renderer if (scr_viewsize.value != 120) Cvar_Set ("viewsize","120"); Just below this there is a set of lines saying :- if (size >= 120) sb_lines = 0; // no status bar at all else if (size >= 110) sb_lines = 24; // no inventory else sb_lines = 24+16+8; So change the code to say :- //muff@yakko.globalnet.co.uk - tells renderer no status bar to worry about sb_lines = 0; //muff@yakko.globalnet.co.uk // this enables status bar, except in intermissions if (!(cl.intermission)) sb_lines = 24; Further down in GL_SCREEN.C, find the SCR_UpdateScreen routine. Find this code :- if (scr_drawdialog) { Sbar_Draw (); Draw_FadeScreen (); SCR_DrawNotifyString (); scr_copyeverything = true; } else if (scr_drawloading) { SCR_DrawLoading (); Sbar_Draw (); } A little further down in the same routine find the code :- SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawConsole (); M_Draw (); // muff@yakko.globalnet.co.uk - 12 Mar 2000 // force redraw for clear status bar stuff if (!(cl.intermission == 2 && key_dest == key_game) && !(cl.intermission == 1 && key_dest == key_game) && !(scr_drawloading) ) Sbar_Changed (); Now open up SBAR.C Find the Sbar_Draw routine near the bottom. Near the top of the routine, find the code :- if (sb_lines && vid.width > 320) Draw_TileClear (0, vid.height - sb_lines, vid.width, sb_lines); A little lower down you will find :- else if (sb_lines) { Sbar_DrawPic (0, 0, sb_sbar); If you compile now, the status bar has no background, and is starting to look like what we're after. Open up GL_DRAW.C Find the routine Draw_Pic in the middle. After it, add the following code. /* ============= Draw_Pic2 - muff for scaling status bar added 20 april 2000 ============= */ void Draw_Pic2 (int x, int y, qpic_t *pic) { byte *dest, *source; unsigned short *pusdest; int v, u; glpic_t *gl; int pw,ph; if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 || (unsigned)(y + pic->height) > vid.height) { Sys_Error ("Draw_TransPic: bad coordinates"); } if (scrap_dirty) Scrap_Upload (); gl = (glpic_t *)pic->data; // first we calculate the scaling factor of the picture pw = (pic->width) * (vid.width /320); ph = (pic->height) * (vid.height/200); //now we calculate the scaled x position x = x*(vid.width/320); y = y*(vid.height/200); glColor4f (1,1,1,1); GL_Bind (gl->texnum); glBegin (GL_QUADS); glTexCoord2f (gl->sl, gl->tl); glVertex2f (x, y); glTexCoord2f (gl->sh, gl->tl); glVertex2f (x+pw, y); glTexCoord2f (gl->sh, gl->th); glVertex2f (x+pw, y+ph ); glTexCoord2f (gl->sl, gl->th); glVertex2f (x, y+ph); glEnd (); } Now re-open SBAR.C Near the top you will find the routine Sbar_DrawPic. Just after it add the following new code. /* ============= Sbar_DrawPic2 - muff - april 20 2000 - scalable scoreboard ============= */ void Sbar_DrawPic2 (int x, int y, qpic_t *pic) { Draw_Pic2 (x , y + (240-SBAR_HEIGHT), pic); } In Sbar_DrawNum routine, find the line Sbar_DrawTransPic (x,y,sb_nums[color][frame]); Sbar_DrawPic2 (x,y,sb_nums[color][frame]); Now lets do the other items on the bar. Find the Sbar_DrawFace routine, and find the code that look like this :- if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) ) == (IT_INVISIBILITY | IT_INVULNERABILITY) ) { Sbar_DrawPic2 (112, 0, sb_face_invis_invuln); return; } if (cl.items & IT_QUAD) { Sbar_DrawPic2 (112, 0, sb_face_quad ); return; } if (cl.items & IT_INVISIBILITY) { Sbar_DrawPic2 (112, 0, sb_face_invis ); return; } if (cl.items & IT_INVULNERABILITY) { Sbar_DrawPic2 (112, 0, sb_face_invuln); return; } At the very end of the routine change the line :- Sbar_DrawPic (112, 0, sb_faces[f][anim]); Sbar_DrawPic2 (112, 0, sb_faces[f][anim]); In Sbar_Draw find this code :- if (cl.items & IT_ARMOR3) Sbar_DrawPic (0, 0, sb_armor[2]); else if (cl.items & IT_ARMOR2) Sbar_DrawPic (0, 0, sb_armor[1]); else if (cl.items & IT_ARMOR1) Sbar_DrawPic (0, 0, sb_armor[0]); Just below this you will find this code :- if (cl.items & IT_SHELLS) Sbar_DrawPic (224, 0, sb_ammo[0]); else if (cl.items & IT_NAILS) Sbar_DrawPic (224, 0, sb_ammo[1]); else if (cl.items & IT_ROCKETS) Sbar_DrawPic (224, 0, sb_ammo[2]); else if (cl.items & IT_CELLS) Sbar_DrawPic (224, 0, sb_ammo[3]); Now compile this. You should now have a scaled status bar. The graphics leave something to be desired at this resolution, but I'm sure someone will change the graphics at some point to smooth this out (Big Hint graphics people) Hope you enjoy the new status bar Muff |