static void KeyCursorDrawFunc( menuframework_s *menu ) { if ( bind_grab ) Draw_Char( menu->x, menu->y + menu->cursor * 9, '=', COLOR_WHITE, 1 ); else Draw_Char( menu->x, menu->y + menu->cursor * 9, 12 + ( ( int ) ( Sys_Milliseconds() / 250 ) & 1 ), COLOR_WHITE, 1 ); }
void DrawHUDString (char *string, int x, int y, int centerwidth, int xor) { int margin; char line[1024]; int width; int i; margin = x; while (*string) { // scan out one line of text from the string width = 0; while (*string && *string != '\n') line[width++] = *string++; line[width] = 0; if (centerwidth) x = margin + (centerwidth - width*8)/2; else x = margin; for (i=0 ; i<width ; i++) { Draw_Char (x, y, line[i]^xor); x += 8; } if (*string) { string++; // skip the \n x = margin; y += 8; } } }
void Menu_DrawStringR2LDark(int x, int y, const char *string, int alpha) { unsigned i; for (i = 0; i < strlen(string); i++) { Draw_Char((x - i * 8), y, string[strlen(string) - i - 1] + 128, alpha); } }
void Menu_DrawString(int x, int y, const char *string, int alpha) { unsigned i; for (i = 0; i < strlen(string); i++) { Draw_Char((x + i * 8), y, string[i], alpha); } }
void Menu_DrawStringR2LDark( int x, int y, const char *string ) { uint32 i; for ( i = 0; i < strlen( string ); i++ ) { Draw_Char( ( x - i*8 ), y, string[strlen(string)-i-1]+128 ); } }
void Menu_DrawString( int x, int y, const char *string ) { uint32 i; for ( i = 0; i < strlen( string ); i++ ) { Draw_Char( ( x + i*8 ), y, string[i] ); } }
void Menu_DrawStringR2L( int x, int y, const char *string ) { unsigned i; for ( i = 0; i < strlen( string ); i++ ) { Draw_Char( ( x - i*8 ), y, string[strlen(string)-i-1] ); } }
void Menu_DrawStringDark( int x, int y, const char *string ) { unsigned i; for ( i = 0; i < strlen( string ); i++ ) { Draw_Char( ( x + i*8 ), y, string[i] + 128 ); } }
void Slider_Draw( menuslider_s *s ) { int i; Menu_DrawStringR2LDark( s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, s->generic.name ); s->range = ( s->curvalue - s->minvalue ) / ( float ) ( s->maxvalue - s->minvalue ); if (FLOAT_LT_ZERO(s->range)) s->range = 0; if ( s->range > 1) s->range = 1; Draw_Char( s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, 128); for ( i = 0; i < SLIDER_RANGE; i++ ) Draw_Char( RCOLUMN_OFFSET + s->generic.x + i*8 + s->generic.parent->x + 8, s->generic.y + s->generic.parent->y, 129); Draw_Char( RCOLUMN_OFFSET + s->generic.x + i*8 + s->generic.parent->x + 8, s->generic.y + s->generic.parent->y, 130); Draw_Char( ( int ) ( 8 + RCOLUMN_OFFSET + s->generic.parent->x + s->generic.x + (SLIDER_RANGE-1)*8 * s->range ), s->generic.y + s->generic.parent->y, 131); }
void Slider_Draw(menuslider_s * s) { int i; int alpha = mouseOverAlpha(&s->generic); Menu_DrawStringR2LDark(s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, s->generic.name, alpha); s->range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue); if (s->range < 0) s->range = 0; if (s->range > 1) s->range = 1; Draw_Char(s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, 128, 255); for (i = 0; i < SLIDER_RANGE; i++) Draw_Char(RCOLUMN_OFFSET + s->generic.x + i * 8 + s->generic.parent->x + 8, s->generic.y + s->generic.parent->y, 129, 255); Draw_Char(RCOLUMN_OFFSET + s->generic.x + i * 8 + s->generic.parent->x + 8, s->generic.y + s->generic.parent->y, 130, 255); Draw_Char((int)(8 + RCOLUMN_OFFSET + s->generic.parent->x + s->generic.x + (SLIDER_RANGE - 1) * 8 * s->range), s->generic.y + s->generic.parent->y, 131, 255); }
void Field_Draw( menufield_s *f ) { int i; char tempbuffer[128]=""; 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 ); strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length ); Draw_Char( f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y - 4, 18 ); Draw_Char( f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y + 4, 24 ); Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y - 4, 20 ); Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y + 4, 26 ); for ( i = 0; i < f->visible_length; i++ ) { Draw_Char( f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y - 4, 19 ); Draw_Char( f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y + 4, 25 ); } Menu_DrawString( f->generic.x + f->generic.parent->x + 24, f->generic.y + f->generic.parent->y, tempbuffer ); if ( Menu_ItemAtCursor( f->generic.parent ) == f ) { int offset; if ( f->visible_offset ) offset = f->visible_length; else offset = f->cursor; if ( ( ( int ) ( Sys_Milliseconds() / 250 ) ) & 1 ) { Draw_Char( f->generic.x + f->generic.parent->x + ( offset + 2 ) * 8 + 8, f->generic.y + f->generic.parent->y, 11 ); } else { Draw_Char( f->generic.x + f->generic.parent->x + ( offset + 2 ) * 8 + 8, f->generic.y + f->generic.parent->y, ' ' ); } } }
void SCR_DrawCenterString (void) { char *start; int l; int j; int x, y; int remaining; // the finale prints the characters one at a time remaining = 9999; scr_erase_center = 0; start = scr_centerstring; if (scr_center_lines <= 4) y = viddef.height*0.35; else y = 48; do { // scan the width of the line for (l=0 ; l<40 ; l++) if (start[l] == '\n' || !start[l]) break; x = (viddef.width - l*8)/2; SCR_AddDirtyPoint (x, y); for (j=0 ; j<l ; j++, x+=8) { Draw_Char (x, y, start[j]); if (!remaining--) return; } SCR_AddDirtyPoint (x, y+8); y += 8; while (*start && *start != '\n') start++; if (!*start) break; start++; // skip the \n } while (1); }
void SCR_DrawCenterString(void) { char *start; int l; int j; int x, y; int remaining; /* the finale prints the characters one at a time */ remaining = 9999; scr_erase_center = 0; start = scr_centerstring; if (scr_center_lines <= 4) { y = viddef.height * 0.35; } else { y = 48; } do { /* scan the width of the line */ for (l = 0; l < 40; l++) { if ((start[l] == '\n') || !start[l]) { break; } } x = (viddef.width - l * 8) / 2; SCR_AddDirtyPoint(x, y); for (j = 0; j < l; j++, x += 8) { Draw_Char(x, y, start[j]); if (!remaining--) { return; } } SCR_AddDirtyPoint(x, y + 8); y += 8; while (*start && *start != '\n') { start++; } if (!*start) { break; } start++; /* skip the \n */ } while (1); }
void Menu_Draw(menuframework_s * menu) { int i; menucommon_s *item; /* * * draw contents */ for (i = 0; i < menu->nitems; i++) { switch (((menucommon_s *) menu->items[i])->type) { case MTYPE_FIELD: Field_Draw((menufield_s *) menu->items[i]); break; case MTYPE_SLIDER: Slider_Draw((menuslider_s *) menu->items[i]); break; case MTYPE_LIST: MenuList_Draw((menulist_s *) menu->items[i]); break; case MTYPE_SPINCONTROL: SpinControl_Draw((menulist_s *) menu->items[i]); break; case MTYPE_ACTION: Action_Draw((menuaction_s *) menu->items[i]); break; case MTYPE_SEPARATOR: Separator_Draw((menuseparator_s *) menu->items[i]); break; } } /* * * now check mouseovers - psychospaz */ cursor.menu = menu; if (cursor.mouseaction) { menucommon_s *lastitem = cursor.menuitem; refreshCursorLink(); for (i = menu->nitems; i >= 0; i--) { int type; int len; int min [2], max[2]; item = ((menucommon_s *) menu->items[i]); if (!item || item->type == MTYPE_SEPARATOR) continue; max[0] = min[0] = menu->x + item->x + RCOLUMN_OFFSET; /* + 2 chars for space + * cursor */ max[1] = min[1] = menu->y + item->y; max[1] += 8; switch (item->type) { case MTYPE_ACTION: { len = strlen(item->name); if (item->flags & QMF_LEFT_JUSTIFY) { min[0] += LCOLUMN_OFFSET * 2; max[0] = min[0] + len * 8; } else { min[0] -= len * 8 + 24; } type = MENUITEM_ACTION; } break; case MTYPE_SLIDER: { min[0] -= 16; max[0] += (SLIDER_RANGE + 2) * 8 + 16; type = MENUITEM_SLIDER; } break; case MTYPE_LIST: case MTYPE_SPINCONTROL: { int len; menulist_s *spin = menu->items[i]; if (item->name) { len = strlen(item->name); min[0] -= len * 8 - LCOLUMN_OFFSET * 2; } len = strlen(spin->itemnames[spin->curvalue]); max[0] += len * 8; type = MENUITEM_ROTATE; } break; case MTYPE_FIELD: { menufield_s *text = menu->items[i]; len = text->visible_length + 2; max[0] += len * 8; type = MENUITEM_TEXT; } break; default: continue; } if (cursor.x >= min[0] && cursor.x <= max[0] && cursor.y >= min[1] && cursor.y <= max[1]) { /* new item */ if (lastitem != item) { int j; for (j = 0; j < MENU_CURSOR_BUTTON_MAX; j++) { cursor.buttonclicks[j] = 0; cursor.buttontime[j] = 0; } } cursor.menuitem = item; cursor.menuitemtype = type; menu->cursor = i; break; } } } cursor.mouseaction = false; item = Menu_ItemAtCursor(menu); if (item && item->cursordraw) { item->cursordraw(item); } else if (menu->cursordraw) { menu->cursordraw(menu); } else if (item && item->type != MTYPE_FIELD) { if (item->flags & QMF_LEFT_JUSTIFY) { Draw_Char(menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ((int)(Sys_Milliseconds() / 250) & 1), 255); } else { Draw_Char(menu->x + item->cursor_offset, menu->y + item->y, 12 + ((int)(Sys_Milliseconds() / 250) & 1), 255); } } if (item) { if (item->statusbarfunc) item->statusbarfunc((void *)item); else if (item->statusbar) Menu_DrawStatusBar(item->statusbar); else Menu_DrawStatusBar(menu->statusbar); } else { Menu_DrawStatusBar(menu->statusbar); } }
void Menu_Draw( menuframework_s *menu ) { int i; menucommon_s *item; /* ** draw contents */ for ( i = 0; i < menu->nitems; i++ ) { switch ( ( ( menucommon_s * ) menu->items[i] )->type ) { case MTYPE_FIELD: Field_Draw( ( menufield_s * ) menu->items[i] ); break; case MTYPE_SLIDER: Slider_Draw( ( menuslider_s * ) menu->items[i] ); break; case MTYPE_LIST: MenuList_Draw( ( menulist_s * ) menu->items[i] ); break; case MTYPE_SPINCONTROL: SpinControl_Draw( ( menulist_s * ) menu->items[i] ); break; case MTYPE_ACTION: Action_Draw( ( menuaction_s * ) menu->items[i] ); break; case MTYPE_SEPARATOR: Separator_Draw( ( menuseparator_s * ) menu->items[i] ); break; } } item = (menucommon_s *) Menu_ItemAtCursor( menu ); if ( item && item->cursordraw ) { item->cursordraw( item ); } else if ( menu->cursordraw ) { menu->cursordraw( menu ); } else if ( item && item->type != MTYPE_FIELD ) { if ( item->flags & QMF_LEFT_JUSTIFY ) { Draw_Char( menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) ); } else { Draw_Char( menu->x + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) ); } } if ( item ) { if ( item->statusbarfunc ) item->statusbarfunc( ( void * ) item ); else if ( item->statusbar ) Menu_DrawStatusBar( item->statusbar ); else Menu_DrawStatusBar( menu->statusbar ); } else { Menu_DrawStatusBar( menu->statusbar ); } }
void Menu_Draw ( menuframework_t *menu ) { char scratch[MAX_QPATH]; static int yaw; // int maxframe = 29; entity_t entity; int i; menucommon_t *item; refdef_t refdef; // Draw rotating Quake II Symbol memset( &refdef, 0, sizeof( refdef ) ); memset( &entity, 0, sizeof( entity ) ); refdef.x = 0; refdef.y = 0; refdef.width = viddef.width; refdef.height = viddef.height; refdef.fov_x = 35; refdef.fov_y = CalcFov( refdef.fov_x, refdef.width, refdef.height ); refdef.time = cls.realtime * 0.001; refdef.areabits = NULL; refdef.num_entities = 1; //refdef.lightstyles = 5; // Gentle Pulse refdef.lightstyles = 63; // Testing (FULLBRIGHT) refdef.rdflags = RDF_NOWORLDMODEL; refdef.blend[0] = 1.0; refdef.blend[1] = 1.0; refdef.blend[2] = 1.0; refdef.blend[3] = 0.0; refdef.dlights = NULL; refdef.num_dlights = 0; refdef.num_particles = 0; refdef.particles = NULL; VectorSet(refdef.viewangles, 1.0, 0.0, 0.0); VectorClear(refdef.vieworg); //if (!strcmp(vid_ref->string, "soft")) // Com_sprintf( scratch, sizeof( scratch ), "models/items/quaddama/tris.md2"); //else Com_sprintf( scratch, sizeof( scratch ), "models/MenuModel/quad.md2"); entity.model = re.RegisterModel( scratch ); //entity.Model_Type = 0; entity.flags = RF_MINLIGHT | RF_DEPTHHACK | RF_FULLBRIGHT | RF_GLOW | RF_NOSHADOW; entity.origin[0] = 80; entity.origin[1] = 0; entity.origin[2] = -18; // -18 compensates for the float height of the model VectorCopy( entity.origin, entity.oldorigin ); entity.frame = 0; entity.oldframe = 0; entity.backlerp = 0.0; entity.angles[1] = yaw++; if ( ++yaw > 360 ) yaw -= 360; refdef.entities = &entity; // Fog the scene //refdef.blend[0] = 0.55; //refdef.blend[1] = 0.55; //refdef.blend[2] = 0.55; //refdef.blend[3] = 0.55; if (cl_3dmenubg->value) { // Draw scene MenuRefdefActive = 1; re.RenderFrame( &refdef ); //Menu_DrawBackground("q2bg.tga"); } // Draw the menu version information if (cl_menustamp->value > 0) { /* 1 - Regular string 2 - Regular string plus drop shadow (green... not effective) 3 - All green string */ if (cl_menustamp->value == 1) { // Draw the text Menu_DrawString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE, MENUSTAMP); } else if (cl_menustamp->value == 2) { // Draw the drop shadow (we need black characters) DrawAltString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3) - 1, viddef.height - FONTSIZE, MENUSTAMP); // Draw the text Menu_DrawString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE - 1, MENUSTAMP); } else if (cl_menustamp->value == 3) { // Draw the text DrawAltString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE, MENUSTAMP); } } // Menu drawing prevention hack for main menu if ((menu->x == -1) && (menu->y == -1)) return; /* ** draw contents */ for ( i = 0; i < menu->nitems; i++ ) { switch ( ( ( menucommon_t * ) menu->items[i] )->type ) { case MTYPE_FIELD: Field_Draw( ( menufield_t * ) menu->items[i] ); break; case MTYPE_SLIDER: Slider_Draw( ( menuslider_t * ) menu->items[i] ); break; case MTYPE_LIST: MenuList_Draw( ( menulist_t * ) menu->items[i] ); break; case MTYPE_SPINCONTROL: SpinControl_Draw( ( menulist_t * ) menu->items[i] ); break; case MTYPE_ACTION: Action_Draw( ( menuaction_t * ) menu->items[i] ); break; case MTYPE_SEPARATOR: Separator_Draw( ( menuseparator_t * ) menu->items[i] ); break; } } item = Menu_ItemAtCursor( menu ); if ( item && item->cursordraw ) { item->cursordraw( item ); } else if ( menu->cursordraw ) { menu->cursordraw( menu ); } else if ( item && item->type != MTYPE_FIELD ) { if ( item->flags & QMF_LEFT_JUSTIFY ) { Draw_Char( menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) ); } else { Draw_Char( menu->x + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) ); } } if ( item ) { if ( item->statusbarfunc ) item->statusbarfunc( ( void * ) item ); else if ( item->statusbar ) Menu_DrawStatusBar( item->statusbar ); else Menu_DrawStatusBar( menu->statusbar ); } else { Menu_DrawStatusBar( menu->statusbar ); } }