void DrawStartSeverLevelshot(void) { char startmap[MAX_QPATH]; char mapshotname[MAX_QPATH]; int i = s_startmap_list.curvalue; Q_strlcpy (startmap, strchr(mapnames[i], '\n') + 1, sizeof(startmap)); SCR_FillRect (SCREEN_WIDTH / 2 + 44, SCREEN_HEIGHT / 2 - 100, 244, 184, colorWhite); if (levelshotvalid[i] == M_UNSET) { // init levelshot Com_sprintf(mapshotname, sizeof(mapshotname), "levelshots/%s.png", startmap); if (RE_Draw_RegisterPic(mapshotname)) levelshotvalid[i] = M_FOUND; else levelshotvalid[i] = M_MISSING; } if (levelshotvalid[i] == M_FOUND) { Com_sprintf (mapshotname, sizeof(mapshotname), "levelshots/%s.png", startmap); SCR_DrawPic (SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 98, 240, 180, mapshotname); } else if (levelshotvalid[nummaps] == M_FOUND) { SCR_DrawPic (SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 98, 240, 180, "levelshots/unknownmap.png"); } else { SCR_FillRect (SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 98, 240, 180, colorBlack); } }
void PlayerConfig_DrawSkinSelection (void) { char scratch[MAX_QPATH]; float icon_x = SCREEN_WIDTH*0.5 - 5; //width - 325 float icon_y = SCREEN_HEIGHT - 108; float icon_offset = 0; float x, y, w, h; int i, count, color[3]; TextColor((int)Cvar_VariableValue("alt_text_color"), &color[0], &color[1], &color[2]); if (s_pmi[s_player_model_box.curvalue].nskins<NUM_SKINBOX_ITEMS || s_player_skin_box.curvalue<4) i=0; else if (s_player_skin_box.curvalue > s_pmi[s_player_model_box.curvalue].nskins-4) i=s_pmi[s_player_model_box.curvalue].nskins-NUM_SKINBOX_ITEMS; else i=s_player_skin_box.curvalue-3; // left arrow if (i>0) Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left.pcx"); else Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left_d.pcx"); SCR_DrawPic (icon_x-39, icon_y+2, 32, 32, ALIGN_CENTER, scratch, 1.0); // background 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); R_DrawTileClear ((int)x, (int)y, (int)w, (int)h, "/gfx/ui/listbox_background.pcx"); } else SCR_DrawFill (icon_x-2, icon_y-2, NUM_SKINBOX_ITEMS*34+2, 36, ALIGN_CENTER, 60,60,60,255); for (count=0; count<NUM_SKINBOX_ITEMS; i++,count++) { if (i<0 || i>=s_pmi[s_player_model_box.curvalue].nskins) continue; Com_sprintf (scratch, sizeof(scratch), "/players/%s/%s_i.pcx", s_pmi[s_player_model_box.curvalue].directory, s_pmi[s_player_model_box.curvalue].skindisplaynames[i] ); if (i==s_player_skin_box.curvalue) SCR_DrawFill (icon_x + icon_offset-1, icon_y-1, 34, 34, ALIGN_CENTER, color[0],color[1],color[2],255); SCR_DrawPic (icon_x + icon_offset, icon_y, 32, 32, ALIGN_CENTER, scratch, 1.0); icon_offset += 34; } // right arrow icon_offset = NUM_SKINBOX_ITEMS*34; if (s_pmi[s_player_model_box.curvalue].nskins-i>0) Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right.pcx"); else Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right_d.pcx"); SCR_DrawPic (icon_x+icon_offset+5, icon_y+2, 32, 32, ALIGN_CENTER, scratch, 1.0); }
/* ================= Menu_DrawBanner ================= */ void Menu_DrawBanner (char *name) { int w, h; R_DrawGetPicSize (&w, &h, name ); SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-150, w, h, ALIGN_CENTER, name, 1.0); }
void DrawMenuCrosshair (void) { SCR_DrawFill2 (SCREEN_WIDTH*0.5 - 18, s_options_ingame_menu.y + 42, 36, 36, ALIGN_CENTER, 60,60,60,255); SCR_DrawFill2 (SCREEN_WIDTH*0.5 - 17, s_options_ingame_menu.y + 43, 34, 34, ALIGN_CENTER, 0,0,0,255); /* R_DrawFill2 ( viddef.width/2 - SCR_ScaledVideo(18), s_options_ingame_menu.y + SCR_ScaledVideo(42), SCR_ScaledVideo(36), SCR_ScaledVideo(36), 60,60,60,255); R_DrawFill2 ( viddef.width/2 - SCR_ScaledVideo(17), s_options_ingame_menu.y + SCR_ScaledVideo(43), SCR_ScaledVideo(34), SCR_ScaledVideo(34), 0,0,0,255); */ if (s_options_ingame_crosshair_box.curvalue < 1) return; SCR_DrawPic (SCREEN_WIDTH*0.5-16, s_options_ingame_menu.y + 44, 32, 32, ALIGN_CENTER, crosshair_names[s_options_ingame_crosshair_box.curvalue], 1.0); /* R_DrawStretchPic ( viddef.width/2 - SCR_ScaledVideo(16), s_options_ingame_menu.y + SCR_ScaledVideo(44), SCR_ScaledVideo(32), SCR_ScaledVideo(32), crosshair_names[s_options_ingame_crosshair_box.curvalue], 1.0); */ }
void M_Quit_Draw (void) { #ifdef QUITMENU_NOKEY Menu_AdjustCursor( &s_quit_menu, 1 ); Menu_Draw( &s_quit_menu ); #else // QUITMENU_NOKEY int w, h; R_DrawGetPicSize (&w, &h, "quit"); SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-h/2, w, h, ALIGN_CENTER, "quit", 1.0); #endif // QUITMENU_NOKEY }
void DrawMenuCrosshair (void) { SCR_DrawFill (SCREEN_WIDTH*0.5 - 18, s_options_screen_menu.y + 42, 36, 36, ALIGN_CENTER, 60,60,60,255); SCR_DrawFill (SCREEN_WIDTH*0.5 - 17, s_options_screen_menu.y + 43, 34, 34, ALIGN_CENTER, 0,0,0,255); if (s_options_screen_crosshair_box.curvalue < 1) return; SCR_DrawPic (SCREEN_WIDTH*0.5-16, s_options_screen_menu.y + 44, 32, 32, ALIGN_CENTER, crosshair_names[s_options_screen_crosshair_box.curvalue], 1.0); }
void DrawSaveshot(qboolean loadmenu) { char shotname [MAX_QPATH]; char mapshotname [MAX_QPATH]; int i; if (loadmenu) { i = s_loadgame_actions[s_loadgame_menu.cursor].generic.localdata[0]; } else { i = s_savegame_actions[s_savegame_menu.cursor].generic.localdata[0]; } SCR_DrawFill(SCREEN_WIDTH / 2 + 44, SCREEN_HEIGHT / 2 - 60, 244, 184, ALIGN_CENTER, 60, 60, 60, 255); if (m_savevalid[i] && m_saveshotvalid[i]) { Com_sprintf(shotname, sizeof(shotname), "/save/kmq2save%i/shot.jpg", i); SCR_DrawPic(SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 58, 240, 180, ALIGN_CENTER, shotname, 1.0); } else if (loadmenu && (i == 0) && m_savevalid[i] && m_mapshotvalid) // autosave shows mapshot { Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", m_mapname); SCR_DrawPic(SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 58, 240, 180, ALIGN_CENTER, mapshotname, 1.0); } else if (m_saveshotvalid[MAX_SAVEGAMES]) { SCR_DrawPic(SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 58, 240, 180, ALIGN_CENTER, "/gfx/ui/noscreen.pcx", 1.0); } else { SCR_DrawFill(SCREEN_WIDTH / 2 + 46, SCREEN_HEIGHT / 2 - 58, 240, 180, ALIGN_CENTER, 0, 0, 0, 255); } }
/* ============= M_Main_Draw ============= */ void M_Main_Draw (void) { int32_t i; int32_t w, h, last_h; int32_t ystart; int32_t xoffset; int32_t widest = -1; int32_t totalheight = 0; char litname[80]; FindMenuCoords (&xoffset, &ystart, &totalheight, &widest); for (i = 0; main_names[i] != 0; i++) if (i != m_main_cursor) { R_DrawGetPicSize (&w, &h, main_names[i]); SCR_DrawPic (xoffset, (ystart + i*40+3), w, h, ALIGN_CENTER, main_names[i], 1.0); } strcpy (litname, main_names[m_main_cursor]); strcat (litname, "_sel"); R_DrawGetPicSize (&w, &h, litname); SCR_DrawPic (xoffset-1, (ystart + m_main_cursor*40+2), w+2, h+2, ALIGN_CENTER, litname, 1.0); // Draw our nifty quad damage model as a cursor if it's loaded. if (quadModel_loaded) UI_DrawMainCursor3D (xoffset-27, ystart+(m_main_cursor*40+1)); else UI_DrawMainCursor (xoffset-25, ystart+(m_main_cursor*40+1), (int32_t)(cls.realtime/100)%NUM_MAINMENU_CURSOR_FRAMES); R_DrawGetPicSize (&w, &h, "m_main_plaque"); SCR_DrawPic (xoffset-(w/2+50), ystart, w, h, ALIGN_CENTER, "m_main_plaque", 1.0); last_h = h; R_DrawGetPicSize (&w, &h, "m_main_logo"); SCR_DrawPic (xoffset-(w/2+50), ystart+last_h+20, w, h, ALIGN_CENTER, "m_main_logo", 1.0); }
/* ============= UI_DrawMainCursor Draws an animating cursor with the point at x,y. The pic will extend to the left of x, and both above and below y. ============= */ void UI_DrawMainCursor (int32_t x, int32_t y, int32_t f) { char cursorname[80]; static qboolean cached; int32_t w,h; if (!cached) { int32_t i; for (i = 0; i < NUM_MAINMENU_CURSOR_FRAMES; i++) { Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", i); R_DrawFindPic (cursorname); } cached = true; } Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", f); R_DrawGetPicSize (&w, &h, cursorname); SCR_DrawPic (x, y, w, h, ALIGN_CENTER, cursorname, 1.0); }
/* ================ Con_DrawSolidConsole Draws the console with the solid background ================ */ void Con_DrawSolidConsole( float frac ) { int i, x, y; int rows; int row; int lines; // qhandle_t conShader; int currentColor; vec4_t color; float yVer; float totalwidth; float currentWidthLocation = 0; const int charHeight = SCR_ConsoleFontCharHeight(); if ( scr_conUseOld->integer ) { lines = cls.glconfig.vidHeight * frac; if ( lines <= 0 ) { return; } if ( lines > cls.glconfig.vidHeight ) { lines = cls.glconfig.vidHeight; } } else { lines = cls.glconfig.vidHeight * frac; } lines += charHeight / ( CONSOLE_FONT_VPADDING + 1 ); // on wide screens, we will center the text if (!scr_conUseOld->integer) { con.xadjust = 15; } SCR_AdjustFrom640 (&con.xadjust, NULL, NULL, NULL); // draw the background if ( scr_conUseOld->integer ) { yVer = 5 + charHeight; y = frac * SCREEN_HEIGHT; if ( y < 1 ) { y = 0; } else { if ( scr_conUseShader->integer ) { SCR_DrawPic( 0, 0, SCREEN_WIDTH, y, cls.consoleShader ); } else { // This will be overwritten, so i'll just abuse it here, no need to define another array color[ 0 ] = scr_conColorRed->value; color[ 1 ] = scr_conColorGreen->value; color[ 2 ] = scr_conColorBlue->value; color[ 3 ] = scr_conColorAlpha->value; SCR_FillRect( 0, 0, SCREEN_WIDTH, y, color ); } } color[ 0 ] = scr_conBarColorRed->value; color[ 1 ] = scr_conBarColorGreen->value; color[ 2 ] = scr_conBarColorBlue->value; color[ 3 ] = scr_conBarColorAlpha->value; SCR_FillRect( 0, y, SCREEN_WIDTH, scr_conBarSize->value, color ); } else { yVer = 10; SCR_AdjustFrom640( NULL, &yVer, NULL, NULL ); yVer = floor( yVer + 5 + charHeight ); color[ 0 ] = scr_conColorRed->value; color[ 1 ] = scr_conColorGreen->value; color[ 2 ] = scr_conColorBlue->value; color[ 3 ] = frac * 2 * scr_conColorAlpha->value; SCR_FillRect( 10, 10, 620, 460 * scr_conHeight->integer * 0.01, color ); color[ 0 ] = scr_conBarColorRed->value; color[ 1 ] = scr_conBarColorGreen->value; color[ 2 ] = scr_conBarColorBlue->value; color[ 3 ] = frac * 2 * scr_conBarColorAlpha->value; SCR_FillRect( 10, 10, 620, 1, color ); //top SCR_FillRect( 10, 460 * scr_conHeight->integer * 0.01 + 10, 621, 1, color ); //bottom SCR_FillRect( 10, 10, 1, 460 * scr_conHeight->integer * 0.01, color ); //left SCR_FillRect( 630, 10, 1, 460 * scr_conHeight->integer * 0.01, color ); //right } // draw the version number color[ 0 ] = 1.0f; color[ 1 ] = 1.0f; color[ 2 ] = 1.0f; color[ 3 ] = ( scr_conUseOld->integer ? 0.75f : frac * 0.75f ); re.SetColor( color ); i = strlen( Q3_VERSION ); totalwidth = SCR_ConsoleFontStringWidth( Q3_VERSION, i ) + cl_conXOffset->integer; if ( !scr_conUseOld->integer ) { totalwidth += 30; } currentWidthLocation = cls.glconfig.vidWidth - totalwidth; for ( x = 0; x < i; x++ ) { int ch = Q_UTF8CodePoint( &Q3_VERSION[ x ] ); SCR_DrawConsoleFontUnichar( currentWidthLocation, yVer, ch ); currentWidthLocation += SCR_ConsoleFontUnicharWidth( ch ); } // engine string i = strlen( Q3_ENGINE ); totalwidth = SCR_ConsoleFontStringWidth( Q3_ENGINE, i ) + cl_conXOffset->integer; if ( !scr_conUseOld->integer ) { totalwidth += 30; } currentWidthLocation = cls.glconfig.vidWidth - totalwidth; for ( x = 0; x < i; x++ ) { int ch = Q_UTF8CodePoint( &Q3_ENGINE[ x ] ); SCR_DrawConsoleFontUnichar( currentWidthLocation, yVer + charHeight, ch ); currentWidthLocation += SCR_ConsoleFontUnicharWidth( ch ); } // draw the input prompt, user text, and cursor if desired // moved back here (have observed render issues to do with time taken) Con_DrawInput(); // draw the text con.vislines = lines; rows = ( lines ) / SCR_ConsoleFontCharHeight() - 3; // rows of text to draw if ( scr_conUseOld->integer ) { rows++; } y = lines - ( SCR_ConsoleFontCharHeight() * 3 ) + 10; // draw from the bottom up if ( con.display != con.current ) { // draw arrows to show the buffer is backscrolled const int hatWidth = SCR_ConsoleFontUnicharWidth( '^' ); color[ 0 ] = 1.0f; color[ 1 ] = 0.0f; color[ 2 ] = 0.0f; color[ 3 ] = ( scr_conUseOld->integer ? 1.0f : frac * 2.0f ); re.SetColor( color ); for ( x = 0; x < con.linewidth - ( scr_conUseOld->integer ? 0 : 4 ); x += 4 ) { SCR_DrawConsoleFontUnichar( con.xadjust + ( x + 1 ) * hatWidth, y, '^' ); } y -= charHeight; rows--; } row = con.display; if ( con.x == 0 ) { row--; } currentColor = 7; color[ 0 ] = g_color_table[ currentColor ][ 0 ]; color[ 1 ] = g_color_table[ currentColor ][ 1 ]; color[ 2 ] = g_color_table[ currentColor ][ 2 ]; color[ 3 ] = ( scr_conUseOld->integer ? 1.0f : frac * 2.0f ); re.SetColor( color ); for ( i = 0; i < rows; i++, y -= charHeight, row-- ) { conChar_t *text; if ( row < 0 ) { break; } if ( con.current - row >= con.totallines ) { // past scrollback wrap point continue; } text = con.text + CON_LINE( row ); currentWidthLocation = cl_conXOffset->integer; for ( x = 0; x < con.linewidth && text[x].ch; ++x ) { if ( text[ x ].ink != currentColor ) { currentColor = text[ x ].ink; color[ 0 ] = g_color_table[ currentColor ][ 0 ]; color[ 1 ] = g_color_table[ currentColor ][ 1 ]; color[ 2 ] = g_color_table[ currentColor ][ 2 ]; color[ 3 ] = ( scr_conUseOld->integer ? 1.0f : frac * 2.0f ); re.SetColor( color ); } SCR_DrawConsoleFontUnichar( con.xadjust + currentWidthLocation, y, text[ x ].ch ); currentWidthLocation += SCR_ConsoleFontUnicharWidth( text[ x ].ch ); } } re.SetColor( NULL ); }