From 0f12083fdb14ae813e419500918b95cb83070586 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 9 Jun 2011 13:57:32 +0000 Subject: Added copies of old numbered releases. --- gui.c | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 391 insertions(+) create mode 100644 gui.c (limited to 'gui.c') diff --git a/gui.c b/gui.c new file mode 100644 index 0000000..a7e41dc --- /dev/null +++ b/gui.c @@ -0,0 +1,391 @@ +/* + + viDOOM - level editor for DOOM + + Copyright (C) 2000 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + Generic GUI type routines + +*/ +static const char rcs_id[]="$Id$"; + +#include "config.h" +#include "globals.h" + +#include +#include +#include + +#include "gui.h" +#include "platgui.h" +#include "mem.h" +#include "ini.h" + +/* ---------------------------------------- VARS +*/ +#define GUI_INI "GUI" + +#define GUI_BORDER (fh/2) +#define GUI_BORDERFULL (GUI_BORDER*2) + +#define GUI_TITLEH (fh*2) +#define GUI_TITLEOFF (fh/2) +#define GUI_FOOTERH (fh*2) +#define GUI_FOOTEROFF (fh/2) + +#define GUI_BEVEL 2 + +#define MAXLINES 512 +#define MAXTEXT 4096 + +#define ANY_CLOSE "Press any key/mouse button to close" +#define ESC_CLOSE "Press ESC key to close" + +#define VIEW_LEN 70 + +int GUI_HI=GREY(210); +int GUI_MID=GREY(180); +int GUI_LO=GREY(140); +int GUI_TEXT=WHITE; +int GUI_TEXTSHADOW=BLACK; +int GUI_TEXTBOLD=BLACK; + +static INI_Table gui_ini[]= + { + {INI_INT,GUI_INI,"high",&GUI_HI,NULL}, + {INI_INT,GUI_INI,"mid",&GUI_MID,NULL}, + {INI_INT,GUI_INI,"low",&GUI_LO,NULL}, + {INI_INT,GUI_INI,"text",&GUI_TEXT,NULL}, + {INI_INT,GUI_INI,"shadow",&GUI_TEXTSHADOW,NULL}, + {INI_INT,GUI_INI,"bold",&GUI_TEXTBOLD,NULL} + }; + +static int SCRW; +static int SCRH; +static int fw; +static int fh; + +static char *doom_levels[]= + {"E1M1","E1M2","E1M3","E1M4","E1M5", + "E1M6","E1M7","E1M8","E1M9", + "E2M1","E2M2","E2M3","E2M4","E2M5", + "E2M6","E2M7","E2M8","E2M9", + "E3M1","E3M2","E3M3","E3M4","E3M5", + "E3M6","E3M7","E3M8","E3M9",NULL}; + +static char *ult_doom_levels[]= + {"E1M1","E1M2","E1M3","E1M4","E1M5", + "E1M6","E1M7","E1M8","E1M9", + "E2M1","E2M2","E2M3","E2M4","E2M5", + "E2M6","E2M7","E2M8","E2M9", + "E3M1","E3M2","E3M3","E3M4","E3M5", + "E3M6","E3M7","E3M8","E3M9", + "E4M1","E4M2","E4M3","E4M4","E4M5", + "E4M6","E4M7","E4M8","E4M9",NULL}; + +static char *doom2_levels[]= + {"MAP01","MAP02","MAP03","MAP04","MAP05", + "MAP06","MAP07","MAP08","MAP09","MAP10", + "MAP11","MAP12","MAP13","MAP14","MAP15", + "MAP16","MAP17","MAP18","MAP19","MAP20", + "MAP21","MAP22","MAP23","MAP24","MAP25", + "MAP26","MAP27","MAP28","MAP29","MAP30", + "MAP31","MAP32",NULL}; + + +/* ---------------------------------------- PRIVATE FUNCTIONS +*/ + +static void CalcBounding(char *text,int *num,char *t[],int min_len, + int *x,int *y,int *w,int *h) +{ + int no; + int f; + char *p; + + no=0; + p=strtok(text,"|"); + + while(p) + { + t[no++]=p; + p=strtok(NULL,"|"); + } + + t[no]=NULL; + + *h=fh*no+GUI_BORDERFULL; + + for(f=0;fmin_len) + min_len=strlen(t[f]); + + *num=no; + *w=fw*min_len+GUI_BORDERFULL; + *x=SCRW/2-*w/2; + *y=SCRH/2-*h/2; +} + + +static void DrawBox(int x,int y,int w,int h,int bevel) +{ + int f; + + GFX_frect(x,y,w,h,GUI_MID); + + for(f=0;f"); + line[f]=NULL; + + GUI_picklist(title,line); + + for(f=0;f