Centered menus for better UX, more intelligent method of saving lmps...
This commit is contained in:
parent
ce1e4235b4
commit
1c7b040e59
3 changed files with 41 additions and 60 deletions
|
@ -514,9 +514,9 @@ Draws one solid graphics character
|
|||
void M_DrawCharacter (int cx, int line, int num)
|
||||
{
|
||||
if (menu_scaled)
|
||||
Draw_Character_Scaled ( cx + ((vid.vconwidth - 320)>>1), line, num);
|
||||
Draw_Character_Scaled ( cx + ((vid.vconwidth - 320)>>1), line + ((vid.vconheight - 240)>>1), num);
|
||||
else
|
||||
Draw_Character ( cx + ((vid.width - 320)>>1), line, num);
|
||||
Draw_Character ( cx + ((vid.width - 320)>>1), line + ((vid.height - 240)>>1), num);
|
||||
}
|
||||
|
||||
void M_Print (int cx, int cy, char *str)
|
||||
|
@ -545,9 +545,9 @@ void M_PrintWhite (int cx, int cy, char *str)
|
|||
void M_DrawPic (int x, int y, qpic_t *pic)
|
||||
{
|
||||
if (menu_scaled)
|
||||
Draw_Pic_Scaled (x + ((vid.vconwidth - 320)>>1), y, pic);
|
||||
Draw_Pic_Scaled (x + ((vid.vconwidth - 320)>>1), y + ((vid.vconheight - 240)>>1), pic);
|
||||
else
|
||||
Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
|
||||
Draw_Pic (x + ((vid.width - 320)>>1), y + ((vid.height - 240)>>1), pic);
|
||||
}
|
||||
|
||||
byte identityTable[256];
|
||||
|
@ -581,9 +581,9 @@ void M_BuildTranslationTable(int top, int bottom)
|
|||
void M_DrawPicTranslate (int x, int y, qpic_t *pic)
|
||||
{
|
||||
if (menu_scaled)
|
||||
Draw_PicTranslate_Scaled (x + ((vid.vconwidth - 320)>>1), y, pic, translationTable);
|
||||
Draw_PicTranslate_Scaled (x + ((vid.vconwidth - 320)>>1), y + ((vid.vconheight - 240)>>1), pic, translationTable);
|
||||
else
|
||||
Draw_PicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
|
||||
Draw_PicTranslate (x + ((vid.width - 320)>>1), y + ((vid.height - 240)>>1), pic, translationTable);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -926,10 +926,12 @@ void Sbar_DeathmatchOverlay (void)
|
|||
// draw the text
|
||||
l = scoreboardlines;
|
||||
|
||||
if (sb_scaled) x = 80 + ((vid.vconwidth - 320)>>1);
|
||||
else x = 80 + ((vid.width - 320)>>1);
|
||||
if (sb_scaled)
|
||||
x = 80 + ((vid.vconwidth - 320)>>1);
|
||||
else
|
||||
x = 80 + ((vid.width - 320)>>1);
|
||||
|
||||
y = 40;
|
||||
y = 40 + ((vid.vconheight - 240)>>1);
|
||||
for (i=0 ; i<l ; i++)
|
||||
{
|
||||
k = fragsort[i];
|
||||
|
@ -943,41 +945,45 @@ void Sbar_DeathmatchOverlay (void)
|
|||
top = Sbar_ColorForMap (top);
|
||||
bottom = Sbar_ColorForMap (bottom);
|
||||
|
||||
if (sb_scaled){
|
||||
Draw_Fill_Scaled ( x, y, 40, 4, top);
|
||||
Draw_Fill_Scaled ( x, y+4, 40, 4, bottom);
|
||||
} else {
|
||||
Draw_Fill ( x, y, 40, 4, top);
|
||||
Draw_Fill ( x, y+4, 40, 4, bottom);
|
||||
if (sb_scaled)
|
||||
{
|
||||
Draw_Fill_Scaled ( x, y, 40, 4, top);
|
||||
Draw_Fill_Scaled ( x, y+4, 40, 4, bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw_Fill ( x, y, 40, 4, top);
|
||||
Draw_Fill ( x, y+4, 40, 4, bottom);
|
||||
}
|
||||
|
||||
// draw number
|
||||
f = s->frags;
|
||||
sprintf (num, "%3i",f);
|
||||
|
||||
if (sb_scaled){
|
||||
Draw_Character_Scaled ( x+8 , y, num[0]);
|
||||
Draw_Character_Scaled ( x+16 , y, num[1]);
|
||||
Draw_Character_Scaled ( x+24 , y, num[2]);
|
||||
if (sb_scaled)
|
||||
{
|
||||
Draw_Character_Scaled ( x+8 , y, num[0]);
|
||||
Draw_Character_Scaled ( x+16 , y, num[1]);
|
||||
Draw_Character_Scaled ( x+24 , y, num[2]);
|
||||
|
||||
if (k == cl.viewentity - 1)
|
||||
Draw_Character_Scaled ( x - 8, y, 12);
|
||||
if (k == cl.viewentity - 1)
|
||||
Draw_Character_Scaled ( x - 8, y, 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw_Character ( x+8 , y, num[0]);
|
||||
Draw_Character ( x+16 , y, num[1]);
|
||||
Draw_Character ( x+24 , y, num[2]);
|
||||
Draw_Character ( x+8 , y, num[0]);
|
||||
Draw_Character ( x+16 , y, num[1]);
|
||||
Draw_Character ( x+24 , y, num[2]);
|
||||
|
||||
if (k == cl.viewentity - 1)
|
||||
Draw_Character ( x - 8, y, 12);
|
||||
if (k == cl.viewentity - 1)
|
||||
Draw_Character ( x - 8, y, 12);
|
||||
}
|
||||
|
||||
// draw name
|
||||
if (sb_scaled)
|
||||
Draw_String_Scaled (x+64, y, s->name);
|
||||
Draw_String_Scaled (x+64, y, s->name);
|
||||
else Draw_String (x+64, y, s->name);
|
||||
y += 10;
|
||||
y += 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,14 +1023,14 @@ void Sbar_MiniDeathmatchOverlay (void)
|
|||
if (fragsort[i] == cl.viewentity - 1)
|
||||
break;
|
||||
|
||||
if (i == scoreboardlines) // we're not there
|
||||
if (i == scoreboardlines) // we're not there
|
||||
i = 0;
|
||||
else // figure out start
|
||||
else // figure out start
|
||||
i = i - numlines/2;
|
||||
|
||||
if (i > scoreboardlines - numlines)
|
||||
if (i > scoreboardlines - numlines)
|
||||
i = scoreboardlines - numlines;
|
||||
if (i < 0)
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
|
||||
x = 324;
|
||||
|
|
|
@ -852,7 +852,7 @@ gint VID_EditorViewColormap(gpointer data)
|
|||
if(pic)
|
||||
{
|
||||
Con_Printf("[EDITOR] Previewing Colormap %s\n", filename);
|
||||
ed_file = Hunk_Alloc(16385 + (sizeof(int) * 2));
|
||||
ed_file = malloc(16385 + (sizeof(int) * 2));
|
||||
|
||||
ed_file->width = 256;
|
||||
ed_file->height = 64;
|
||||
|
@ -931,7 +931,6 @@ gint VID_EditorSaveFile(gpointer data)
|
|||
GtkFileChooser *chooser;
|
||||
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||
gint res;
|
||||
byte *pic;
|
||||
|
||||
if(!ed_file)
|
||||
return;
|
||||
|
@ -972,19 +971,6 @@ gint VID_EditorSaveFile(gpointer data)
|
|||
filename = gtk_file_chooser_get_filename (chooser);
|
||||
|
||||
Con_Printf("[EDITOR] Saving LUMP as %s...\n", filename);
|
||||
|
||||
pic = malloc((sizeof(int)*2) + (ed_file->width * ed_file->height));
|
||||
|
||||
pic[0] = ed_file->width;
|
||||
pic[1] = ed_file->height;
|
||||
|
||||
memcpy(pic, &ed_file->width, sizeof(int));
|
||||
memcpy(pic + sizeof(int), &ed_file->height, sizeof(int));
|
||||
|
||||
int i;
|
||||
for(i = 0; i < ed_file->width * ed_file->height; i++)
|
||||
pic[i+(sizeof(int) * 2)] = ed_file->data[i];
|
||||
|
||||
#if 0
|
||||
printf("Saving IMAGE: %i, %i\n", pic[0], pic[1]);
|
||||
for(i = 2; i < pic[0] * pic[1]+2; i++)
|
||||
|
@ -992,9 +978,9 @@ gint VID_EditorSaveFile(gpointer data)
|
|||
printf("\n...DONE\n");
|
||||
#endif
|
||||
|
||||
COM_WriteFile (filename, pic, ed_file->width * ed_file->height + 2);
|
||||
COM_WriteFile (filename, ed_file, ed_file->width * ed_file->height + 2);
|
||||
g_free (filename);
|
||||
free(pic);
|
||||
// free(pic);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
@ -1314,17 +1300,6 @@ gint VID_EditorQuit(gpointer data)
|
|||
{
|
||||
Con_Printf("[EDITOR] Shutting down\n");
|
||||
gtk_widget_destroy(ed_window);
|
||||
|
||||
if(ed_file)
|
||||
free(ed_file);
|
||||
if(ed_palfile)
|
||||
free(ed_palfile);
|
||||
|
||||
free(ed_palpic);
|
||||
free(ed_backtile);
|
||||
//free(ed_palette);
|
||||
gdk_rgb_cmap_free(ed_cmap);
|
||||
|
||||
vid_ineditor = false;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue