void Field_Draw (menufield_s *f) { int i, alpha = mouseOverAlpha(&f->generic), xtra; char tempbuffer[128]=""; int offset; if (f->generic.name) Menu_DrawStringR2LDark (f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET, f->generic.y + f->generic.parent->y, f->generic.name, 255); if (xtra = stringLengthExtra(f->buffer)) { strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length ); offset = strlen(tempbuffer) - xtra; if (offset > f->visible_length) { f->visible_offset = offset - f->visible_length; strncpy( tempbuffer, f->buffer + f->visible_offset - xtra, f->visible_length + xtra ); offset = f->visible_offset; } } else { strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length ); offset = strlen(tempbuffer); } SCR_DrawChar (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*2, f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 18, 255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*2, f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 24, 255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+f->visible_length)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 20,255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+f->visible_length)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 26, 255,255,255,255, false, false); for (i = 0; i < f->visible_length; i++) { SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+i)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 19, 255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+i)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 25, 255,255,255,255, false, (i==(f->visible_length-1))); } // add cursor thingie if ( Menu_ItemAtCursor(f->generic.parent)==f && ((int)(Sys_Milliseconds()/250))&1 ) Com_sprintf(tempbuffer, sizeof(tempbuffer), "%s%c", tempbuffer, 11); Menu_DrawString (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*3, f->generic.y + f->generic.parent->y, tempbuffer, alpha); }
void M_Credits_MenuDraw(void) { float alpha, time = (cls.realtime - credits_start_time) * 0.05; int i, y, x, len, stringoffset; qboolean bold; if ((SCREEN_HEIGHT - ((cls.realtime - credits_start_time) / 40.0F) + credits_start_line * MENU_LINE_SIZE) < 0) { credits_start_line++; if (!credits[credits_start_line]) { credits_start_line = 0; credits_start_time = cls.realtime; } } // // draw the credits // for (i = credits_start_line, y = SCREEN_HEIGHT - ((cls.realtime - credits_start_time) / 40.0F) + credits_start_line * MENU_LINE_SIZE; credits[i] && y < SCREEN_HEIGHT; y += MENU_LINE_SIZE, i++) { stringoffset = 0; bold = false; if (y <= -MENU_FONT_SIZE) { continue; } if (y > SCREEN_HEIGHT) { continue; } if (credits[i][0] == '+') { bold = true; stringoffset = 1; } else { bold = false; stringoffset = 0; } if (y > SCREEN_HEIGHT * (7.0 / 8.0)) { float y_test, h_test; y_test = y - SCREEN_HEIGHT * (7.0 / 8.0); h_test = SCREEN_HEIGHT / 8; alpha = 1 - (y_test / h_test); alpha = max(min(alpha, 1), 0); } else if (y < SCREEN_HEIGHT / 8) { float y_test, h_test; y_test = y; h_test = SCREEN_HEIGHT / 8; alpha = y_test / h_test; alpha = max(min(alpha, 1), 0); } else { alpha = 1; } len = strlen(credits[i]) - stringLengthExtra(credits[i]); x = (SCREEN_WIDTH - len * MENU_FONT_SIZE - stringoffset * MENU_FONT_SIZE) / 2 + stringoffset * MENU_FONT_SIZE; Menu_DrawString(x, y, credits[i], alpha * 255); } }