mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
Second gtk startup window patch from bioman, other random fixes I can't be bothered to remember
git-svn-id: https://svn.eduke32.com/eduke32@1544 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
094079d8dd
commit
1770c60af6
13 changed files with 448 additions and 273 deletions
|
@ -3,8 +3,8 @@
|
|||
ENGINELIB=libengine.a
|
||||
EDITORLIB=libbuild.a
|
||||
|
||||
# SDLCONFIG = /usr/local/bin/sdl-config
|
||||
SDLCONFIG = sdl-config
|
||||
SDLCONFIG = /usr/local/bin/sdl-config
|
||||
# SDLCONFIG = sdl-config
|
||||
|
||||
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
||||
SDLROOT = /usr/local
|
||||
|
|
|
@ -265,6 +265,12 @@ EXTERN char gotsector[(MAXSECTORS+7)>>3];
|
|||
EXTERN char captureformat;
|
||||
EXTERN char editorcolors[256];
|
||||
|
||||
EXTERN int32_t faketilesiz[MAXTILES];
|
||||
EXTERN char *faketiledata[MAXTILES];
|
||||
|
||||
EXTERN char spritecol2d[MAXTILES][2];
|
||||
extern char vgapal16[4*256];
|
||||
|
||||
extern char vgapalette[5*256];
|
||||
extern uint32_t drawlinepat;
|
||||
|
||||
|
|
|
@ -117,12 +117,16 @@ GtkCellRenderer *(*gtk_cell_renderer_text_new) (void);
|
|||
GtkWidget* (*gtk_check_button_new_with_mnemonic) (const gchar *label);
|
||||
|
||||
// gtkcombobox.h
|
||||
gint (*gtk_combo_box_get_active) (GtkComboBox *combo_box);
|
||||
gboolean (*gtk_combo_box_get_active_iter) (GtkComboBox *combo_box,
|
||||
GtkTreeIter *iter);
|
||||
gchar (*gtk_combo_box_get_active_text) (GtkComboBox *combo_box);
|
||||
GtkTreeModel *(*gtk_combo_box_get_model) (GtkComboBox *combo_box);
|
||||
GType (*gtk_combo_box_get_type) (void) G_GNUC_CONST;
|
||||
GtkWidget *(*gtk_combo_box_new_text) (void);
|
||||
GtkWidget *(*gtk_combo_box_new_with_model) (GtkTreeModel *model);
|
||||
void (*gtk_combo_box_set_active) (GtkComboBox *combo_box,
|
||||
gint index_);
|
||||
void (*gtk_combo_box_set_active_iter) (GtkComboBox *combo_box,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
|
@ -293,8 +297,15 @@ void (*gtk_toggle_button_set_active) (GtkToggleButton *toggle_butto
|
|||
void (*gtk_tree_model_get) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
gboolean (*gtk_tree_model_get_iter) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath * (*gtk_tree_model_get_path) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
GType (*gtk_tree_model_get_type) (void) G_GNUC_CONST;
|
||||
|
||||
gint *(*gtk_tree_path_get_indices) (GtkTreePath *path);
|
||||
GtkTreePath *(*gtk_tree_path_new_from_indices) (gint first_index,
|
||||
...);
|
||||
// gtktreeselection.h
|
||||
gboolean (*gtk_tree_selection_get_selected) (GtkTreeSelection *selection,
|
||||
GtkTreeModel **model,
|
||||
|
@ -442,11 +453,14 @@ void dynamicgtk_uninit(void);
|
|||
#define gtk_check_button_new_with_mnemonic dynamicgtksyms.gtk_check_button_new_with_mnemonic
|
||||
|
||||
// gtkcombobox.h
|
||||
#define gtk_combo_box_get_active dynamicgtksyms.gtk_combo_box_get_active
|
||||
#define gtk_combo_box_get_active_iter dynamicgtksyms.gtk_combo_box_get_active_iter
|
||||
#define gtk_combo_box_get_active_text dynamicgtksyms.gtk_combo_box_get_active_text
|
||||
#define gtk_combo_box_get_model dynamicgtksyms.gtk_combo_box_get_model
|
||||
#define gtk_combo_box_get_type dynamicgtksyms.gtk_combo_box_get_type
|
||||
#define gtk_combo_box_new_text dynamicgtksyms.gtk_combo_box_new_text
|
||||
#define gtk_combo_box_new_with_model dynamicgtksyms.gtk_combo_box_new_with_model
|
||||
#define gtk_combo_box_set_active dynamicgtksyms.gtk_combo_box_set_active
|
||||
#define gtk_combo_box_set_active_iter dynamicgtksyms.gtk_combo_box_set_active_iter
|
||||
|
||||
// gtkcontainer.h
|
||||
|
@ -548,7 +562,11 @@ void dynamicgtk_uninit(void);
|
|||
|
||||
// gtktreemodel.h
|
||||
#define gtk_tree_model_get dynamicgtksyms.gtk_tree_model_get
|
||||
#define gtk_tree_model_get_iter dynamicgtksyms.gtk_tree_model_get_iter
|
||||
#define gtk_tree_model_get_path dynamicgtksyms.gtk_tree_model_get_path
|
||||
#define gtk_tree_model_get_type dynamicgtksyms.gtk_tree_model_get_type
|
||||
#define gtk_tree_path_get_indices dynamicgtksyms.gtk_tree_path_get_indices
|
||||
#define gtk_tree_path_new_from_indices dynamicgtksyms.gtk_tree_path_new_from_indices
|
||||
|
||||
// gtktreeselection.h
|
||||
#define gtk_tree_selection_get_selected dynamicgtksyms.gtk_tree_selection_get_selected
|
||||
|
|
|
@ -283,14 +283,9 @@ static int32_t getatoken(scriptfile *sf, tokenlist *tl, int32_t ntokens)
|
|||
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
|
||||
extern int32_t nextvoxid;
|
||||
|
||||
extern int32_t faketilesiz[MAXTILES];
|
||||
extern char *faketiledata[MAXTILES];
|
||||
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
extern float alphahackarray[MAXTILES];
|
||||
#endif
|
||||
extern char spritecol2d[MAXTILES][2];
|
||||
extern char vgapal16[4*256];
|
||||
|
||||
static const char *skyfaces[6] =
|
||||
{
|
||||
|
|
|
@ -50,11 +50,14 @@ int32_t dynamicgtk_init(void)
|
|||
GETDLSYM(gtk_cell_layout_set_attributes)
|
||||
GETDLSYM(gtk_cell_renderer_text_new)
|
||||
GETDLSYM(gtk_check_button_new_with_mnemonic)
|
||||
GETDLSYM(gtk_combo_box_get_active)
|
||||
GETDLSYM(gtk_combo_box_get_active_iter)
|
||||
GETDLSYM(gtk_combo_box_get_active_text)
|
||||
GETDLSYM(gtk_combo_box_get_model)
|
||||
GETDLSYM(gtk_combo_box_get_type)
|
||||
GETDLSYM(gtk_combo_box_new_text)
|
||||
GETDLSYM(gtk_combo_box_new_with_model)
|
||||
GETDLSYM(gtk_combo_box_set_active)
|
||||
GETDLSYM(gtk_combo_box_set_active_iter)
|
||||
GETDLSYM(gtk_container_add)
|
||||
GETDLSYM(gtk_container_foreach)
|
||||
|
@ -119,7 +122,11 @@ int32_t dynamicgtk_init(void)
|
|||
GETDLSYM(gtk_toggle_button_get_type)
|
||||
GETDLSYM(gtk_toggle_button_set_active)
|
||||
GETDLSYM(gtk_tree_model_get)
|
||||
GETDLSYM(gtk_tree_model_get_iter)
|
||||
GETDLSYM(gtk_tree_model_get_path)
|
||||
GETDLSYM(gtk_tree_model_get_type)
|
||||
GETDLSYM(gtk_tree_path_get_indices)
|
||||
GETDLSYM(gtk_tree_path_new_from_indices)
|
||||
GETDLSYM(gtk_tree_selection_get_selected)
|
||||
GETDLSYM(gtk_tree_selection_select_iter)
|
||||
GETDLSYM(gtk_tree_selection_set_mode)
|
||||
|
|
|
@ -126,6 +126,12 @@ extern char textfont[2048], smalltextfont[2048];
|
|||
static char kensmessage[128];
|
||||
char *engineerrstr = "No error";
|
||||
|
||||
int32_t showfirstwall=0;
|
||||
int32_t showheightindicators=2;
|
||||
int32_t circlewall=-1;
|
||||
|
||||
char cachedebug = 0;
|
||||
|
||||
#if defined(_MSC_VER) && !defined(NOASM)
|
||||
|
||||
//
|
||||
|
@ -7925,12 +7931,6 @@ int32_t loadpics(char *filename, int32_t askedsize)
|
|||
//
|
||||
// loadtile
|
||||
//
|
||||
char cachedebug = 0;
|
||||
int32_t faketilesiz[MAXTILES];
|
||||
char *faketiledata[MAXTILES];
|
||||
int32_t h_xsize[MAXTILES], h_ysize[MAXTILES];
|
||||
int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
|
||||
|
||||
void loadtile(int16_t tilenume)
|
||||
{
|
||||
char *ptr;
|
||||
|
@ -10951,12 +10951,6 @@ void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16
|
|||
//
|
||||
// draw2dscreen
|
||||
//
|
||||
|
||||
char spritecol2d[MAXTILES][2];
|
||||
int32_t showfirstwall=0;
|
||||
int32_t showheightindicators=2;
|
||||
int32_t circlewall=-1;
|
||||
|
||||
void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride)
|
||||
{
|
||||
walltype *wal;
|
||||
|
|
|
@ -609,6 +609,12 @@ void mmulti_generic(int32_t other, char *bufptr, int32_t messleng, int32_t comma
|
|||
# ifndef MSG_ERRQUEUE /* legacy glibc header workaround... */
|
||||
# define MSG_ERRQUEUE 0x2000
|
||||
# endif
|
||||
# ifndef INVALID_SOCKET
|
||||
# define INVALID_SOCKET -1
|
||||
# endif
|
||||
# ifndef SOCKET_ERROR
|
||||
# define SOCKET_ERROR -1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define SOCKET_SHUTDOWN_BOTH 2
|
||||
|
@ -662,7 +668,7 @@ int32_t mmulti_getexternaladdress(char *buffer, const char *host, int32_t port)
|
|||
|
||||
// initprintf("sent %d bytes\n",bytes_sent);
|
||||
recv(mysock, (char *)&tempbuf, sizeof(tempbuf), 0);
|
||||
closesocket(mysock);
|
||||
socketclose(mysock);
|
||||
j = Bstrlen(text);
|
||||
for (i=Bstrlen(tempbuf);i>0;i--)
|
||||
if (!Bstrncmp(&tempbuf[i], text, j))
|
||||
|
@ -1269,7 +1275,7 @@ static int32_t connect_to_server(gcomtype *gcom, int32_t myip)
|
|||
srand(myip + udpport);
|
||||
else
|
||||
{
|
||||
i = inet_addr(addrbuf);
|
||||
uint32_t i = inet_addr(addrbuf);
|
||||
if (i != INADDR_NONE)
|
||||
srand(i + myip + udpport);
|
||||
else srand(myip + udpport);
|
||||
|
@ -1491,7 +1497,7 @@ static int32_t connect_to_everyone(gcomtype *gcom, int32_t myip, int32_t bcast)
|
|||
srand(myip + udpport);
|
||||
else
|
||||
{
|
||||
i = inet_addr(addrbuf);
|
||||
uint32_t i = inet_addr(addrbuf);
|
||||
if (i != INADDR_NONE)
|
||||
srand(i + myip + udpport);
|
||||
else srand(myip + udpport);
|
||||
|
|
|
@ -89,6 +89,7 @@ static char keytranslation[SDL_NUM_SCANCODES];
|
|||
static int32_t buildkeytranslationtable(void);
|
||||
|
||||
//static SDL_Surface * loadtarga(const char *fn); // for loading the icon
|
||||
static SDL_Surface * appicon;
|
||||
static SDL_Surface * loadappicon(void);
|
||||
|
||||
int32_t wm_msgbox(char *name, char *fmt, ...)
|
||||
|
@ -295,16 +296,11 @@ int32_t initsystem(void)
|
|||
#endif
|
||||
|
||||
#ifndef __APPLE__
|
||||
{
|
||||
SDL_Surface *icon;
|
||||
//icon = loadtarga("icon.tga");
|
||||
icon = loadappicon();
|
||||
if (icon)
|
||||
{
|
||||
SDL_WM_SetIcon(icon, 0);
|
||||
SDL_FreeSurface(icon);
|
||||
}
|
||||
}
|
||||
|
||||
//icon = loadtarga("icon.tga");
|
||||
appicon = loadappicon();
|
||||
if (appicon)
|
||||
SDL_WM_SetIcon(appicon, 0);
|
||||
#endif
|
||||
|
||||
if (SDL_VideoDriverName(drvname, 32))
|
||||
|
@ -340,6 +336,9 @@ void uninitsystem(void)
|
|||
uninitmouse();
|
||||
uninittimer();
|
||||
|
||||
if (appicon)
|
||||
SDL_FreeSurface(appicon);
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
|
@ -1443,7 +1442,8 @@ int32_t setpalette(int32_t start, int32_t num)
|
|||
curpalettefaded[i].f = pal[i].unused = 0;
|
||||
|
||||
//return SDL_SetPalette(sdl_surface, SDL_LOGPAL|SDL_PHYSPAL, pal, 0, 256);
|
||||
return SDL_SetColors(sdl_surface, pal, 0, 256);
|
||||
|
||||
return sdl_surface ? SDL_SetColors(sdl_surface, pal, 0, 256) : 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
#include "build.h"
|
||||
#include "editor.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
enum {
|
||||
TAB_CONFIG,
|
||||
TAB_MESSAGES,
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -18,7 +20,6 @@ static struct
|
|||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configtlayout;
|
||||
GtkWidget *vmode2dlabel;
|
||||
GtkWidget *vmode3dlabel;
|
||||
|
@ -142,7 +143,7 @@ static void SetPage(int32_t n)
|
|||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(stwidgets.startbutton, n);
|
||||
gtk_container_foreach(GTK_CONTAINER(stwidgets.configvlayout),
|
||||
gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout),
|
||||
(GtkCallback)gtk_widget_set_sensitive,
|
||||
(gpointer)&n);
|
||||
}
|
||||
|
@ -243,13 +244,9 @@ static GtkWidget *create_window(void)
|
|||
gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.tabs), 4);
|
||||
|
||||
// Vertical layout of config page
|
||||
stwidgets.configvlayout = gtk_vbox_new(FALSE, 12);
|
||||
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.configvlayout);
|
||||
|
||||
// layout table of config page
|
||||
stwidgets.configtlayout = gtk_table_new(3, 3, FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.configvlayout), stwidgets.configtlayout, TRUE, TRUE, 0);
|
||||
stwidgets.configtlayout = gtk_table_new(4, 3, FALSE);
|
||||
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.configtlayout);
|
||||
|
||||
// 2D video mode label
|
||||
stwidgets.vmode2dlabel = gtk_label_new_with_mnemonic("_2D Video mode:");
|
||||
|
@ -307,7 +304,7 @@ static GtkWidget *create_window(void)
|
|||
|
||||
// Always show config checkbox
|
||||
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.configvlayout), stwidgets.alwaysshowcheck, FALSE, FALSE, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,2, 3,4, GTK_FILL, 0, 4, 6);
|
||||
gtk_widget_add_accelerator(stwidgets.alwaysshowcheck, "grab_focus", stwidgets.accel_group,
|
||||
GDK_A, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
|
|
@ -396,6 +396,22 @@
|
|||
RelativePath=".\source\grpscan.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\m32def.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\m32exec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\m32structures.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\m32vars.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\mdump.cpp"
|
||||
>
|
||||
|
|
|
@ -987,34 +987,24 @@ void C_InitHashes()
|
|||
inithashnames();
|
||||
|
||||
hash_init(&keywH);
|
||||
for (i=NUMKEYWORDS-1; i>=0; i--)
|
||||
hash_add(&keywH,keyw[i],i);
|
||||
|
||||
hash_init(§orH);
|
||||
for (i=0; SectorLabels[i].lId >=0 ; i++)
|
||||
hash_add(§orH,SectorLabels[i].name,i);
|
||||
hash_init(&wallH);
|
||||
for (i=0; WallLabels[i].lId >=0 ; i++)
|
||||
hash_add(&wallH,WallLabels[i].name,i);
|
||||
hash_init(&userdefH);
|
||||
for (i=0; UserdefsLabels[i].lId >=0 ; i++)
|
||||
hash_add(&userdefH,UserdefsLabels[i].name,i);
|
||||
|
||||
hash_init(&projectileH);
|
||||
for (i=0; ProjectileLabels[i].lId >=0 ; i++)
|
||||
hash_add(&projectileH,ProjectileLabels[i].name,i);
|
||||
hash_init(&playerH);
|
||||
for (i=0; PlayerLabels[i].lId >=0 ; i++)
|
||||
hash_add(&playerH,PlayerLabels[i].name,i);
|
||||
hash_init(&inputH);
|
||||
for (i=0; InputLabels[i].lId >=0 ; i++)
|
||||
hash_add(&inputH,InputLabels[i].name,i);
|
||||
hash_init(&actorH);
|
||||
for (i=0; ActorLabels[i].lId >=0 ; i++)
|
||||
hash_add(&actorH,ActorLabels[i].name,i);
|
||||
hash_init(&tspriteH);
|
||||
for (i=0; TsprLabels[i].lId >=0 ; i++)
|
||||
hash_add(&tspriteH,TsprLabels[i].name,i);
|
||||
|
||||
for (i=NUMKEYWORDS-1; i>=0; i--) hash_add(&keywH,keyw[i],i);
|
||||
for (i=0; SectorLabels[i].lId; i++) hash_add(§orH,SectorLabels[i].name,i);
|
||||
for (i=0; WallLabels[i].lId; i++) hash_add(&wallH,WallLabels[i].name,i);
|
||||
for (i=0; UserdefsLabels[i].lId; i++) hash_add(&userdefH,UserdefsLabels[i].name,i);
|
||||
for (i=0; ProjectileLabels[i].lId; i++) hash_add(&projectileH,ProjectileLabels[i].name,i);
|
||||
for (i=0; PlayerLabels[i].lId; i++) hash_add(&playerH,PlayerLabels[i].name,i);
|
||||
for (i=0; InputLabels[i].lId; i++) hash_add(&inputH,InputLabels[i].name,i);
|
||||
for (i=0; ActorLabels[i].lId; i++) hash_add(&actorH,ActorLabels[i].name,i);
|
||||
for (i=0; TsprLabels[i].lId; i++) hash_add(&tspriteH,TsprLabels[i].name,i);
|
||||
}
|
||||
|
||||
void C_FreeHashes(void)
|
||||
|
@ -1126,11 +1116,14 @@ static int32_t C_SetScriptSize(int32_t size)
|
|||
// initprintf("script: %d, bitptr: %d\n",script,bitptr);
|
||||
|
||||
//initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script));
|
||||
if (g_caseScriptPtr != NULL)
|
||||
|
||||
if (g_caseScriptPtr)
|
||||
g_caseScriptPtr = (intptr_t *)(script+ocaseScriptPtr);
|
||||
if (g_parsingEventPtr != NULL)
|
||||
|
||||
if (g_parsingEventPtr)
|
||||
g_parsingEventPtr = (intptr_t *)(script+oparsingEventPtr);
|
||||
if (g_parsingActorPtr != NULL)
|
||||
|
||||
if (g_parsingActorPtr)
|
||||
g_parsingActorPtr = (intptr_t *)(script+oparsingActorPtr);
|
||||
|
||||
for (i=MAXSECTORS-1; i>=0; i--)
|
||||
|
@ -1187,57 +1180,62 @@ static int32_t C_SetScriptSize(int32_t size)
|
|||
|
||||
static int32_t C_SkipComments(void)
|
||||
{
|
||||
char c = *textptr;
|
||||
|
||||
do
|
||||
{
|
||||
if (c == ' ' || c == '\t' || c == '\r')
|
||||
textptr++;
|
||||
else if (c == '\n')
|
||||
switch (*textptr)
|
||||
{
|
||||
case '\n':
|
||||
g_lineNumber++;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
textptr++;
|
||||
}
|
||||
else if (c == '/' && textptr[1] == '/')
|
||||
{
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||
initprintf("%s:%d: debug: got comment.\n",g_szScriptFileName,g_lineNumber);
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
|
||||
textptr++;
|
||||
}
|
||||
else if (c == '/' && textptr[1] == '*')
|
||||
{
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||
initprintf("%s:%d: debug: got start of comment block.\n",g_szScriptFileName,g_lineNumber);
|
||||
while (*textptr && !(textptr[0] == '*' && textptr[1] == '/'))
|
||||
break;
|
||||
case '/':
|
||||
switch (textptr[1])
|
||||
{
|
||||
if (*textptr == '\n')
|
||||
g_lineNumber++;
|
||||
textptr++;
|
||||
}
|
||||
if ((!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) && (textptr[0] == '*' && textptr[1] == '/'))
|
||||
initprintf("%s:%d: debug: got end of comment block.\n",g_szScriptFileName,g_lineNumber);
|
||||
if (!*textptr)
|
||||
{
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug)
|
||||
initprintf("%s:%d: debug: EOF in comment!\n",g_szScriptFileName,g_lineNumber);
|
||||
C_ReportError(-1);
|
||||
initprintf("%s:%d: error: found `/*' with no `*/'.\n",g_szScriptFileName,g_lineNumber);
|
||||
g_processingState = g_numBraces = 0;
|
||||
g_parsingActorPtr = 0;
|
||||
g_numCompilerErrors++;
|
||||
case '/': // C++ style comment
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||
initprintf("%s:%d: debug: got comment.\n",g_szScriptFileName,g_lineNumber);
|
||||
while (*textptr && *textptr != 0x0a && *textptr != 0x0d)
|
||||
textptr++;
|
||||
break;
|
||||
case '*': // beginning of a C style comment
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||
initprintf("%s:%d: debug: got start of comment block.\n",g_szScriptFileName,g_lineNumber);
|
||||
do
|
||||
{
|
||||
if (*textptr == '\n')
|
||||
g_lineNumber++;
|
||||
textptr++;
|
||||
}
|
||||
while (*textptr && (textptr[0] != '*' || textptr[1] != '/'));
|
||||
|
||||
if (!*textptr)
|
||||
{
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug)
|
||||
initprintf("%s:%d: debug: EOF in comment!\n",g_szScriptFileName,g_lineNumber);
|
||||
C_ReportError(-1);
|
||||
initprintf("%s:%d: error: found `/*' with no `*/'.\n",g_szScriptFileName,g_lineNumber);
|
||||
g_parsingActorPtr = (intptr_t *)(g_processingState = g_numBraces = 0);
|
||||
g_numCompilerErrors++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||
initprintf("%s:%d: debug: got end of comment block.\n",g_szScriptFileName,g_lineNumber);
|
||||
|
||||
textptr+=2;
|
||||
break;
|
||||
}
|
||||
else textptr+=2;
|
||||
break;
|
||||
|
||||
case 0: // EOF
|
||||
default:
|
||||
return ((g_scriptPtr-script) > (g_scriptSize-32)) ? C_SetScriptSize(g_scriptSize<<1) : 0;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
while ((c = *textptr));
|
||||
|
||||
if ((unsigned)(g_scriptPtr-script) > (unsigned)(g_scriptSize-32))
|
||||
return C_SetScriptSize(g_scriptSize<<1);
|
||||
|
||||
return 0;
|
||||
while (1);
|
||||
}
|
||||
|
||||
static void C_SetProjectile(int32_t lVar1, int32_t lLabelID, int32_t lVar2)
|
||||
|
@ -1450,14 +1448,6 @@ static void C_GetNextLabelName(void)
|
|||
|
||||
C_SkipComments();
|
||||
|
||||
while (isalnum(*textptr) == 0)
|
||||
{
|
||||
if (*textptr == 0x0a) g_lineNumber++;
|
||||
textptr++;
|
||||
if (*textptr == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r')
|
||||
label[(g_numLabels<<6)+(i++)] = *(textptr++);
|
||||
|
@ -1496,13 +1486,8 @@ static int32_t C_GetNextKeyword(void) //Returns its code #
|
|||
|
||||
C_SkipComments();
|
||||
|
||||
while (isaltok(*textptr) == 0)
|
||||
{
|
||||
if (*textptr == 0x0a) g_lineNumber++;
|
||||
if (*textptr == 0)
|
||||
return -1;
|
||||
textptr++;
|
||||
}
|
||||
if (*textptr == 0) // EOF
|
||||
return -1;
|
||||
|
||||
l = 0;
|
||||
while (isaltok(*(textptr+l)) && !(*(textptr + l) == '.'))
|
||||
|
@ -1800,13 +1785,8 @@ static int32_t C_GetNextValue(int32_t type)
|
|||
|
||||
C_SkipComments();
|
||||
|
||||
while (isaltok(*textptr) == 0)
|
||||
{
|
||||
if (*textptr == 0x0a) g_lineNumber++;
|
||||
textptr++;
|
||||
if (*textptr == 0)
|
||||
return -1; // eof
|
||||
}
|
||||
if (*textptr == 0) // EOF
|
||||
return -1;
|
||||
|
||||
l = 0;
|
||||
while (isaltok(*(textptr+l)))
|
||||
|
@ -2509,12 +2489,9 @@ static int32_t C_ParseCommand(void)
|
|||
|
||||
case CON_INCLUDE:
|
||||
g_scriptPtr--;
|
||||
while (isaltok(*textptr) == 0)
|
||||
{
|
||||
if (*textptr == 0x0a) g_lineNumber++;
|
||||
textptr++;
|
||||
if (*textptr == 0) break;
|
||||
}
|
||||
|
||||
C_SkipComments();
|
||||
|
||||
j = 0;
|
||||
while (isaltok(*textptr))
|
||||
{
|
||||
|
@ -2567,6 +2544,9 @@ static int32_t C_ParseCommand(void)
|
|||
g_checkingIfElse = 0;
|
||||
|
||||
textptr = mptr;
|
||||
|
||||
C_SkipComments();
|
||||
|
||||
do done = C_ParseCommand();
|
||||
while (!done);
|
||||
|
||||
|
@ -5199,12 +5179,8 @@ repeatcase:
|
|||
case CON_SETDEFNAME:
|
||||
{
|
||||
g_scriptPtr--;
|
||||
while (isaltok(*textptr) == 0)
|
||||
{
|
||||
if (*textptr == 0x0a) g_lineNumber++;
|
||||
textptr++;
|
||||
if (*textptr == 0) break;
|
||||
}
|
||||
C_SkipComments();
|
||||
|
||||
j = 0;
|
||||
while (isaltok(*textptr))
|
||||
{
|
||||
|
@ -5220,12 +5196,8 @@ repeatcase:
|
|||
case CON_SETCFGNAME:
|
||||
{
|
||||
g_scriptPtr--;
|
||||
while (isaltok(*textptr) == 0)
|
||||
{
|
||||
if (*textptr == 0x0a) g_lineNumber++;
|
||||
textptr++;
|
||||
if (*textptr == 0) break;
|
||||
}
|
||||
C_SkipComments();
|
||||
|
||||
j = 0;
|
||||
while (isaltok(*textptr))
|
||||
{
|
||||
|
|
|
@ -118,7 +118,6 @@ void GAME_onshowosd(int32_t shown)
|
|||
// most of this is copied from my dummytile stuff in defs.c
|
||||
if (!tilesizx[BGTILE] || !tilesizy[BGTILE])
|
||||
{
|
||||
extern int32_t faketilesiz[MAXTILES];
|
||||
int32_t j;
|
||||
|
||||
tilesizx[BGTILE] = BGTILE_SIZEX;
|
||||
|
|
|
@ -9,11 +9,29 @@
|
|||
#include "grpscan.h"
|
||||
#include "build.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_GAME 1
|
||||
#define TAB_MESSAGES 2
|
||||
#define Polymost 3
|
||||
#define Polymer 4
|
||||
#define RDR_POLYMOST 3 // sould be defined elsewhere
|
||||
#define RDR_POLYMER 4 // sould be defined elsewhere
|
||||
|
||||
enum {
|
||||
NONE,
|
||||
ALL,
|
||||
POPULATE_VIDEO,
|
||||
POPULATE_CONFIG,
|
||||
POPULATE_GAME,
|
||||
};
|
||||
|
||||
enum {
|
||||
TAB_CONFIG,
|
||||
TAB_GAME,
|
||||
TAB_MESSAGES,
|
||||
};
|
||||
|
||||
enum {
|
||||
INPUT_KB,
|
||||
INPUT_MOUSE,
|
||||
INPUT_JOYSTICK,
|
||||
INPUT_ALL,
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -21,41 +39,40 @@ static struct
|
|||
GtkWidget *hlayout;
|
||||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configtlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configtlayout;
|
||||
GtkWidget *displayvlayout;
|
||||
GtkWidget *vmode3dlabel;
|
||||
GtkWidget *vmode3dcombo;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *polymercheck;
|
||||
GtkWidget *inputdevlabel;
|
||||
GtkWidget *inputdevcombo;
|
||||
GtkWidget *custommodlabel;
|
||||
GtkWidget *custommodcombo;
|
||||
GtkWidget *emptyhlayout;
|
||||
GtkWidget *inputdevlabel;
|
||||
GtkWidget *inputhlayout;
|
||||
GtkWidget *inputmousecheck;
|
||||
GtkWidget *inputjoycheck;
|
||||
GtkWidget *autoloadcheck;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *gamevlayout;
|
||||
GtkWidget *gamelabel;
|
||||
GtkWidget *gamescroll;
|
||||
GtkWidget *gamelist;
|
||||
GtkWidget *gametab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *gamevlayout;
|
||||
GtkWidget *gamelabel;
|
||||
GtkWidget *gamescroll;
|
||||
GtkWidget *gamelist;
|
||||
GtkWidget *gametab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
} stwidgets;
|
||||
|
||||
static struct
|
||||
|
@ -68,12 +85,13 @@ static struct
|
|||
int32_t usemouse, usejoy;
|
||||
int32_t game;
|
||||
int32_t crcval;
|
||||
char *custommoddir;
|
||||
char selectedgrp[BMAX_PATH];
|
||||
} settings;
|
||||
|
||||
static int32_t retval = -1, mode = TAB_MESSAGES;
|
||||
extern int32_t gtkenabled;
|
||||
static void PopulateForm(int32_t pgs);
|
||||
static void PopulateForm(unsigned char pgs);
|
||||
|
||||
|
||||
// -- EVENT CALLBACKS AND CREATION STUFF --------------------------------------
|
||||
|
@ -84,6 +102,7 @@ static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
|||
GtkTreeIter iter;
|
||||
int32_t val;
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
|
||||
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
|
||||
if (!(data = gtk_combo_box_get_model(combobox))) return;
|
||||
gtk_tree_model_get(data, &iter, 1, &val, -1);
|
||||
|
@ -95,7 +114,7 @@ static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer u
|
|||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.fullscreen = gtk_toggle_button_get_active(togglebutton);
|
||||
PopulateForm(1<<TAB_CONFIG);
|
||||
PopulateForm(POPULATE_VIDEO);
|
||||
}
|
||||
|
||||
static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
|
@ -103,39 +122,59 @@ static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user
|
|||
UNREFERENCED_PARAMETER(user_data);
|
||||
if (gtk_toggle_button_get_active(togglebutton))
|
||||
{
|
||||
glrendmode = Polymer;
|
||||
glrendmode = RDR_POLYMER;
|
||||
settings.polymer = TRUE;
|
||||
if (settings.bpp3d == 8)
|
||||
{
|
||||
settings.bpp3d = 32;
|
||||
PopulateForm(1<<TAB_CONFIG);
|
||||
PopulateForm(POPULATE_VIDEO);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glrendmode = Polymost;
|
||||
glrendmode = RDR_POLYMOST;
|
||||
settings.polymer = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void on_inputdevcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
switch (gtk_combo_box_get_active(combobox))
|
||||
{
|
||||
case 0: settings.usemouse = 0; settings.usejoy = 0; break;
|
||||
case 1: settings.usemouse = 1; settings.usejoy = 0; break;
|
||||
case 2: settings.usemouse = 0; settings.usejoy = 1; break;
|
||||
case 3: settings.usemouse = 1; settings.usejoy = 1; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void on_custommodcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
char *value;
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
|
||||
if (gtk_combo_box_get_active_iter (combobox, &iter))
|
||||
{
|
||||
model = gtk_combo_box_get_model (combobox);
|
||||
gtk_tree_model_get( model, &iter, 0,&value, -1 );
|
||||
path = gtk_tree_model_get_path(model, &iter);
|
||||
|
||||
if (*gtk_tree_path_get_indices (path) == NONE)
|
||||
settings.custommoddir = NULL;
|
||||
else settings.custommoddir = value;
|
||||
}
|
||||
}
|
||||
|
||||
static void on_autoloadcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.autoload = gtk_toggle_button_get_active(togglebutton);
|
||||
}
|
||||
|
||||
static void on_inputmousecheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.usemouse = gtk_toggle_button_get_active(togglebutton);
|
||||
}
|
||||
|
||||
static void on_inputjoycheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.usejoy = gtk_toggle_button_get_active(togglebutton);
|
||||
}
|
||||
|
||||
static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
|
@ -164,6 +203,7 @@ static void on_gamelist_selection_changed(GtkTreeSelection *selection, gpointer
|
|||
GtkTreeModel *model;
|
||||
struct grpfile *fg;
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
|
||||
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||
{
|
||||
gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1);
|
||||
|
@ -201,25 +241,60 @@ static void SetPage(int32_t n)
|
|||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(stwidgets.startbutton, n);
|
||||
gtk_container_foreach(GTK_CONTAINER(stwidgets.configvlayout),
|
||||
gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout),
|
||||
(GtkCallback)gtk_widget_set_sensitive,
|
||||
(gpointer)&n);
|
||||
}
|
||||
|
||||
static void PopulateForm(int32_t pgs)
|
||||
static unsigned char GetModsDirNames(GtkListStore *list)
|
||||
{
|
||||
if (pgs & (1<<TAB_CONFIG))
|
||||
char *homedir;
|
||||
char pdir[BMAX_PATH];
|
||||
unsigned char iternumb = 0;
|
||||
CACHE1D_FIND_REC *dirs = NULL;
|
||||
GtkTreeIter iter;
|
||||
|
||||
pathsearchmode = 1;
|
||||
|
||||
if ((homedir = Bgethomedir()))
|
||||
{
|
||||
Bsnprintf(pdir, sizeof(pdir), "%s/" ".eduke32", homedir);
|
||||
dirs = klistpath(pdir, "*", CACHE1D_FIND_DIR);
|
||||
for (dirs=dirs; dirs != NULL; dirs=dirs->next)
|
||||
{
|
||||
if ((Bstrcmp(dirs->name, "autoload") == 0) ||
|
||||
(Bstrcmp(dirs->name, "..") == 0) ||
|
||||
(Bstrcmp(dirs->name, ".") == 0))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
gtk_list_store_append(list, &iter);
|
||||
gtk_list_store_set(list, &iter, 0,dirs->name, -1);
|
||||
iternumb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
klistfree(dirs);
|
||||
dirs = NULL;
|
||||
|
||||
return iternumb;
|
||||
}
|
||||
|
||||
static void PopulateForm(unsigned char pgs)
|
||||
{
|
||||
if ((pgs == ALL) || (pgs == POPULATE_VIDEO))
|
||||
{
|
||||
int32_t mode3d, i;
|
||||
GtkListStore *modes3d;
|
||||
GtkTreeIter iter;
|
||||
GtkComboBox *box3d;
|
||||
char buf[64];
|
||||
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
|
||||
for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
|
@ -229,9 +304,8 @@ static void PopulateForm(int32_t pgs)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
box3d = GTK_COMBO_BOX(stwidgets.vmode3dcombo);
|
||||
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
|
||||
|
||||
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.vmode3dcombo)));
|
||||
gtk_list_store_clear(modes3d);
|
||||
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
|
@ -244,21 +318,88 @@ static void PopulateForm(int32_t pgs)
|
|||
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
|
||||
if (i == mode3d)
|
||||
{
|
||||
g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
gtk_combo_box_set_active_iter(box3d, &iter);
|
||||
g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
g_signal_handlers_block_by_func(stwidgets.vmode3dcombo, on_vmode3dcombo_changed, NULL);
|
||||
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(stwidgets.vmode3dcombo), &iter);
|
||||
g_signal_handlers_unblock_by_func(stwidgets.vmode3dcombo, on_vmode3dcombo_changed, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((pgs == ALL) || (pgs == POPULATE_CONFIG))
|
||||
{
|
||||
GtkListStore *devlist, *modsdir;
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
char *value;
|
||||
unsigned char i, r = 0;
|
||||
const char *availabledev[] = {
|
||||
"Keyboard only",
|
||||
"Keyboard and mouse",
|
||||
"Keyboard and joystick",
|
||||
"All supported devices"
|
||||
};
|
||||
|
||||
// populate input devices combo
|
||||
devlist = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.inputdevcombo)));
|
||||
gtk_list_store_clear(devlist);
|
||||
|
||||
for (i=0; i<(int32_t)G_N_ELEMENTS(availabledev); i++)
|
||||
{
|
||||
gtk_list_store_append(devlist, &iter);
|
||||
gtk_list_store_set(devlist, &iter, 0,availabledev[i], -1);
|
||||
}
|
||||
switch (settings.usemouse)
|
||||
{
|
||||
case 0: if (settings.usejoy)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_JOYSTICK);
|
||||
else
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_KB);
|
||||
break;
|
||||
case 1: if (settings.usejoy)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_ALL);
|
||||
else
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_MOUSE);
|
||||
break;
|
||||
}
|
||||
|
||||
// populate custom mod combo
|
||||
modsdir = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.custommodcombo)));
|
||||
gtk_list_store_clear(modsdir);
|
||||
|
||||
gtk_list_store_append(modsdir, &iter);
|
||||
gtk_list_store_set(modsdir, &iter, 0,"None", -1);
|
||||
r = GetModsDirNames(modsdir);
|
||||
|
||||
for(i=0; i<=r; i++)
|
||||
{
|
||||
path = gtk_tree_path_new_from_indices( i, -1 );
|
||||
gtk_tree_model_get_iter( GTK_TREE_MODEL(modsdir), &iter, path );
|
||||
gtk_tree_model_get( GTK_TREE_MODEL(modsdir), &iter, 0,&value, -1 );
|
||||
|
||||
if (Bstrcmp(settings.custommoddir, "/") == 0)
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.custommodcombo), NONE);
|
||||
settings.custommoddir = NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
if (Bstrcmp(settings.custommoddir, value) == 0)
|
||||
{
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (stwidgets.custommodcombo),
|
||||
&iter);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// populate check buttons
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.fullscreen);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.polymercheck), settings.polymer);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.autoloadcheck), settings.autoload);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.forcesetup);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.inputmousecheck), settings.usemouse);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.inputjoycheck), settings.usejoy);
|
||||
}
|
||||
}
|
||||
|
||||
if (pgs & (1<<TAB_GAME))
|
||||
if ((pgs == ALL) || (pgs == POPULATE_GAME))
|
||||
{
|
||||
struct grpfile *fg;
|
||||
int32_t i;
|
||||
|
@ -336,18 +477,14 @@ static GtkWidget *create_window(void)
|
|||
gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.tabs), 4);
|
||||
|
||||
// Vertical layout of config page
|
||||
stwidgets.configvlayout = gtk_vbox_new(FALSE, 12);
|
||||
gtk_container_add (GTK_CONTAINER (stwidgets.tabs), stwidgets.configvlayout);
|
||||
|
||||
// layout table of config page
|
||||
stwidgets.configtlayout = gtk_table_new(3, 3, FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.configvlayout), stwidgets.configtlayout, TRUE, TRUE, 0);
|
||||
stwidgets.configtlayout = gtk_table_new(6, 3, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (stwidgets.tabs), stwidgets.configtlayout);
|
||||
|
||||
// 3D video mode LabelText
|
||||
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
|
||||
gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 6);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 0);
|
||||
|
||||
// 3D video mode combo
|
||||
{
|
||||
|
@ -361,44 +498,67 @@ static GtkWidget *create_window(void)
|
|||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 6);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 0);
|
||||
|
||||
// Fullscreen checkbox
|
||||
stwidgets.displayvlayout = gtk_vbox_new(TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, 0, 4, 6);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, 0, 4, 0);
|
||||
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.fullscreencheck, FALSE, FALSE, 0);
|
||||
|
||||
// Polymer checkbox
|
||||
stwidgets.polymercheck = gtk_check_button_new_with_mnemonic("_Polymer");
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.polymercheck, FALSE, FALSE, 0);
|
||||
|
||||
// Input devices LabelText
|
||||
stwidgets.inputdevlabel = gtk_label_new_with_mnemonic("_Input devices:");
|
||||
gtk_misc_set_alignment(GTK_MISC(stwidgets.inputdevlabel), 0.3, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 1,2, GTK_FILL, 0, 4, 0);
|
||||
|
||||
// Input devices combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
stwidgets.inputdevcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
|
||||
|
||||
// Custom mod LabelText
|
||||
stwidgets.custommodlabel = gtk_label_new_with_mnemonic("Custom _Mod:");
|
||||
gtk_misc_set_alignment(GTK_MISC(stwidgets.custommodlabel), 0.3, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodlabel, 0,1, 2,3, GTK_FILL, 0, 4, 7);
|
||||
|
||||
// Custom mod combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
stwidgets.custommodcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodcombo, 1,2, 2,3, GTK_EXPAND | GTK_FILL, 0, 4, 7);
|
||||
|
||||
// Empty horizontal layout
|
||||
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, 0, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
|
||||
// Input devices LabelText
|
||||
stwidgets.inputdevlabel = gtk_label_new("Input devices:");
|
||||
gtk_misc_set_alignment(GTK_MISC(stwidgets.inputdevlabel), 0.3, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 3,4, GTK_FILL, 0, 4, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, 0, GTK_EXPAND | GTK_FILL, 4, 0);
|
||||
|
||||
// Input devices checkbox
|
||||
stwidgets.inputhlayout = gtk_hbox_new(FALSE, 4);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.inputhlayout, 1,2, 3,4, GTK_EXPAND | GTK_FILL, 0, 4, 0);
|
||||
|
||||
stwidgets.inputmousecheck = gtk_check_button_new_with_mnemonic("Mo_use");
|
||||
stwidgets.inputjoycheck = gtk_check_button_new_with_mnemonic("_Joystick");
|
||||
|
||||
gtk_box_pack_start (GTK_BOX(stwidgets.inputhlayout), stwidgets.inputmousecheck, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX(stwidgets.inputhlayout), stwidgets.inputjoycheck, FALSE, FALSE, 0);
|
||||
|
||||
// Autoload checkbox
|
||||
stwidgets.autoloadcheck = gtk_check_button_new_with_mnemonic("_Enable \"autoload\" folder");
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.configvlayout), stwidgets.autoloadcheck, FALSE, FALSE, 0);
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.autoloadcheck, 0,3, 4,5, GTK_FILL, 0, 2, 2);
|
||||
|
||||
// Always show config checkbox
|
||||
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
|
||||
gtk_box_pack_start(GTK_BOX(stwidgets.configvlayout), stwidgets.alwaysshowcheck, FALSE, FALSE, 0);
|
||||
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show this window at startup");
|
||||
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,3, 5,6, GTK_FILL, 0, 2, 2);
|
||||
|
||||
// Configuration tab
|
||||
stwidgets.configtab = gtk_label_new("Configuration");
|
||||
|
@ -508,34 +668,34 @@ static GtkWidget *create_window(void)
|
|||
gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Wire up the signals
|
||||
g_signal_connect((gpointer) stwidgets.startwin, "delete_event",
|
||||
g_signal_connect((gpointer) stwidgets.startwin, "delete_event",
|
||||
G_CALLBACK(on_startwin_delete_event),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled",
|
||||
G_CALLBACK(on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.polymercheck, "toggled",
|
||||
G_CALLBACK(on_polymercheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.autoloadcheck, "toggled",
|
||||
G_CALLBACK(on_autoloadcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.inputmousecheck, "toggled",
|
||||
G_CALLBACK(on_inputmousecheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.inputjoycheck, "toggled",
|
||||
G_CALLBACK(on_inputjoycheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed",
|
||||
g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed",
|
||||
G_CALLBACK(on_vmode3dcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled",
|
||||
g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled",
|
||||
G_CALLBACK(on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.polymercheck, "toggled",
|
||||
G_CALLBACK(on_polymercheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.inputdevcombo, "changed",
|
||||
G_CALLBACK(on_inputdevcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.custommodcombo, "changed",
|
||||
G_CALLBACK(on_custommodcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.autoloadcheck, "toggled",
|
||||
G_CALLBACK(on_autoloadcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled",
|
||||
G_CALLBACK(on_alwaysshowcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked",
|
||||
g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked",
|
||||
G_CALLBACK(on_cancelbutton_clicked),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) stwidgets.startbutton, "clicked",
|
||||
g_signal_connect((gpointer) stwidgets.startbutton, "clicked",
|
||||
G_CALLBACK(on_startbutton_clicked),
|
||||
NULL);
|
||||
{
|
||||
|
@ -548,6 +708,8 @@ static GtkWidget *create_window(void)
|
|||
|
||||
// Associate labels with their controls
|
||||
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.vmode3dlabel), stwidgets.vmode3dcombo);
|
||||
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.inputdevlabel), stwidgets.inputdevcombo);
|
||||
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.custommodlabel), stwidgets.custommodcombo);
|
||||
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.gamelabel), stwidgets.gamelist);
|
||||
|
||||
return stwidgets.startwin;
|
||||
|
@ -651,8 +813,6 @@ int32_t startwin_idle(void *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern char *duke3dgrp, *duke3dgrpstring;
|
||||
|
||||
int32_t startwin_run(void)
|
||||
{
|
||||
if (!gtkenabled) return 1;
|
||||
|
@ -660,23 +820,24 @@ int32_t startwin_run(void)
|
|||
|
||||
SetPage(TAB_CONFIG);
|
||||
|
||||
settings.fullscreen = ud.config.ScreenMode;
|
||||
settings.xdim3d = ud.config.ScreenWidth;
|
||||
settings.ydim3d = ud.config.ScreenHeight;
|
||||
settings.bpp3d = ud.config.ScreenBPP;
|
||||
settings.forcesetup = ud.config.ForceSetup;
|
||||
settings.fullscreen = ud.config.ScreenMode;
|
||||
settings.usemouse = ud.config.UseMouse;
|
||||
settings.usejoy = ud.config.UseJoystick;
|
||||
settings.custommoddir = mod_dir;
|
||||
settings.forcesetup = ud.config.ForceSetup;
|
||||
settings.game = g_gameType;
|
||||
Bstrncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
|
||||
if (ud.config.NoAutoLoad) settings.autoload = FALSE;
|
||||
else settings.autoload = TRUE;
|
||||
if (glrendmode == Polymer)
|
||||
if (glrendmode == RDR_POLYMER)
|
||||
{
|
||||
if (settings.bpp3d == 8) settings.bpp3d = 32;
|
||||
settings.polymer = TRUE;
|
||||
}
|
||||
PopulateForm(-1);
|
||||
PopulateForm(ALL);
|
||||
|
||||
gtk_main();
|
||||
|
||||
|
@ -684,16 +845,20 @@ int32_t startwin_run(void)
|
|||
if (retval) // launch the game with these parameters
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
ud.config.ScreenMode = settings.fullscreen;
|
||||
|
||||
ud.config.ScreenWidth = settings.xdim3d;
|
||||
ud.config.ScreenHeight = settings.ydim3d;
|
||||
ud.config.ScreenBPP = settings.bpp3d;
|
||||
ud.config.ForceSetup = settings.forcesetup;
|
||||
ud.config.ScreenMode = settings.fullscreen;
|
||||
ud.config.UseMouse = settings.usemouse;
|
||||
ud.config.UseJoystick = settings.usejoy;
|
||||
ud.config.ForceSetup = settings.forcesetup;
|
||||
duke3dgrp = settings.selectedgrp;
|
||||
g_gameType = settings.game;
|
||||
if (settings.custommoddir != NULL)
|
||||
Bstrcpy(mod_dir, settings.custommoddir);
|
||||
else Bsprintf(mod_dir, "/");
|
||||
|
||||
if (settings.autoload) ud.config.NoAutoLoad = FALSE;
|
||||
else ud.config.NoAutoLoad = TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue