From 1770c60af612f53fd64b9bb15887055029149a37 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 18 Nov 2009 01:17:56 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/Makefile.shared | 4 +- polymer/eduke32/build/include/build.h | 6 + polymer/eduke32/build/include/dynamicgtk.h | 20 +- polymer/eduke32/build/src/defs.c | 5 - polymer/eduke32/build/src/dynamicgtk.c | 7 + polymer/eduke32/build/src/engine.c | 18 +- polymer/eduke32/build/src/mmulti_unstable.c | 12 +- polymer/eduke32/build/src/sdlayer.c | 22 +- polymer/eduke32/build/src/startgtk.editor.c | 19 +- polymer/eduke32/eduke32.vcproj | 16 + polymer/eduke32/source/gamedef.c | 180 ++++----- polymer/eduke32/source/osdfuncs.c | 1 - polymer/eduke32/source/startgtk.game.c | 411 ++++++++++++++------ 13 files changed, 448 insertions(+), 273 deletions(-) diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index 8b3243215..6e8cf5b18 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -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 diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 9531ab9a6..6a385a806 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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; diff --git a/polymer/eduke32/build/include/dynamicgtk.h b/polymer/eduke32/build/include/dynamicgtk.h index 009b68da7..e16c5bd9e 100644 --- a/polymer/eduke32/build/include/dynamicgtk.h +++ b/polymer/eduke32/build/include/dynamicgtk.h @@ -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 diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 638674d1a..c53e5c21d 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -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] = { diff --git a/polymer/eduke32/build/src/dynamicgtk.c b/polymer/eduke32/build/src/dynamicgtk.c index 393698e65..82d213998 100644 --- a/polymer/eduke32/build/src/dynamicgtk.c +++ b/polymer/eduke32/build/src/dynamicgtk.c @@ -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) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index e8b7a4517..54e114b71 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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; diff --git a/polymer/eduke32/build/src/mmulti_unstable.c b/polymer/eduke32/build/src/mmulti_unstable.c index 3b3e88dd8..c09df079e 100644 --- a/polymer/eduke32/build/src/mmulti_unstable.c +++ b/polymer/eduke32/build/src/mmulti_unstable.c @@ -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); diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 9b4d3c761..6830bfe79 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -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; } // diff --git a/polymer/eduke32/build/src/startgtk.editor.c b/polymer/eduke32/build/src/startgtk.editor.c index 9b3098e64..cc4a05af0 100644 --- a/polymer/eduke32/build/src/startgtk.editor.c +++ b/polymer/eduke32/build/src/startgtk.editor.c @@ -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); diff --git a/polymer/eduke32/eduke32.vcproj b/polymer/eduke32/eduke32.vcproj index f46d1367a..5a7a4e006 100644 --- a/polymer/eduke32/eduke32.vcproj +++ b/polymer/eduke32/eduke32.vcproj @@ -396,6 +396,22 @@ RelativePath=".\source\grpscan.c" > + + + + + + + + diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 1ef207788..2d9736420 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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)) { diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index ffac019a8..8a5053a4e 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -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; diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c index 9ca56289e..1ff030902 100644 --- a/polymer/eduke32/source/startgtk.game.c +++ b/polymer/eduke32/source/startgtk.game.c @@ -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<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