A bunch of crap I meant to commit days ago... gtk startup window patch from bioman, nedmalloc REPLACE_SYSTEM_ALLOCATOR fix (related code uses #ifdef REPLACE_SYSTEM_ALLOCATOR so defining it to 0 was still satisfying the condition), slightly lower CPU usage in Mapster 2D mode, fix an ancient bug causing the player to not make vent footstep sounds on sprite based vents, fix map save state cvars, add "skill" cvar to console, fix saving the game while CON_SHOWVIEW is in use

git-svn-id: https://svn.eduke32.com/eduke32@1540 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-11-14 02:30:47 +00:00
parent 1573ee6e17
commit 2c9aeac2d5
25 changed files with 914 additions and 1117 deletions

View file

@ -312,4 +312,4 @@ clean:
-rm -f $(OBJ)/* eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) core* duke3d_w32$(EXESUFFIX) && $(MAKE) -C $(JAUDIOLIBDIR) clean
veryclean: clean
-rm -f $(EOBJ)/*
-rm -f $(EOBJ)/* $(RSRC)/*banner*

View file

@ -97,8 +97,8 @@ ifeq (4,$(GCC_MAJOR))
endif
endif
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Wno-char-subscripts \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-Wno-char-subscripts -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC) -D_FORTIFY_SOURCE=2 \
-fjump-tables -fno-stack-protector
# -march=pentium3 -mtune=generic -mmmx -m3dnow -msse -mfpmath=sse

View file

@ -322,13 +322,13 @@ SPRITE VARIABLES:
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
Example: if the linked lists look like the following:
????????????????????????????????
????????????????
Sector lists: Status lists:
???????????????????????????????J
????????????????J
Sector0: 4, 5, 8 Status0: 2, 0, 8
Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9
Sector2: 3, 9
????????????????????????????????
????????????????
Notice that each number listed above is shown exactly once on both the
left and right side. This is because any sprite that exists must
be in some sector, and must have some kind of status that you define.

View file

@ -36,7 +36,7 @@
#endif
#define USE_ALLOCATOR 1
#define REPLACE_SYSTEM_ALLOCATOR 0
// #define REPLACE_SYSTEM_ALLOCATOR
#define USE_MAGIC_HEADERS 0
#include "nedmalloc.h"

View file

@ -140,14 +140,6 @@ void (*gtk_container_set_border_width) (GtkContainer *container,
GType (*gtk_dialog_get_type) (void) G_GNUC_CONST;
gint (*gtk_dialog_run) (GtkDialog *dialog);
// gtkfixed.h
GType (*gtk_fixed_get_type) (void) G_GNUC_CONST;
GtkWidget* (*gtk_fixed_new) (void);
void (*gtk_fixed_put) (GtkFixed *fixed,
GtkWidget *widget,
gint x,
gint y);
// gtkhbox.h
GtkWidget* (*gtk_hbox_new) (gboolean homogeneous,
gint spacing);
@ -224,6 +216,22 @@ void (*gtk_scrolled_window_set_policy) (GtkScrolledWindow *scro
GtkPolicyType vscrollbar_policy);
void (*gtk_scrolled_window_set_shadow_type) (GtkScrolledWindow *scrolled_window,
GtkShadowType type);
// gtktable.h
GType (*gtk_table_get_type) (void) G_GNUC_CONST;
GtkWidget* (*gtk_table_new) (guint rows,
guint columns,
gboolean homogeneous);
void (*gtk_table_attach) (GtkTable *table,
GtkWidget *child,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach,
GtkAttachOptions xoptions,
GtkAttachOptions yoptions,
guint xpadding,
guint ypadding);
// gtktextbuffer.h
gboolean (*gtk_text_buffer_backspace) (GtkTextBuffer *buffer,
@ -245,7 +253,7 @@ void (*gtk_text_buffer_insert) (GtkTextBuffer *buffer,
// gtktextiter.h
// FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0)
// around these three, or should I not care??
// around these three, or should I not care?
gboolean (*gtk_text_iter_backward_cursor_position) (GtkTextIter *iter);
gboolean (*gtk_text_iter_equal) (const GtkTextIter *lhs,
const GtkTextIter *rhs);
@ -352,7 +360,7 @@ void (*gtk_widget_set_sensitive) (GtkWidget *widget
void (*gtk_widget_set_size_request) (GtkWidget *widget,
gint width,
gint height);
void (*gtk_widget_show) (GtkWidget *widget);
void (*gtk_widget_show_all) (GtkWidget *widget);
void (*gtk_widget_unref) (GtkWidget *widget);
// gtkwindow.h
@ -451,11 +459,6 @@ void dynamicgtk_uninit(void);
#define gtk_dialog_get_type dynamicgtksyms.gtk_dialog_get_type
#define gtk_dialog_run dynamicgtksyms.gtk_dialog_run
// gtkfixed.h
#define gtk_fixed_get_type dynamicgtksyms.gtk_fixed_get_type
#define gtk_fixed_new dynamicgtksyms.gtk_fixed_new
#define gtk_fixed_put dynamicgtksyms.gtk_fixed_put
// gtkhbox.h
#define gtk_hbox_new dynamicgtksyms.gtk_hbox_new
@ -510,6 +513,11 @@ void dynamicgtk_uninit(void);
#define gtk_scrolled_window_set_policy dynamicgtksyms.gtk_scrolled_window_set_policy
#define gtk_scrolled_window_set_shadow_type dynamicgtksyms.gtk_scrolled_window_set_shadow_type
// gtktable.h
#define gtk_table_get_type dynamicgtksyms.gtk_table_get_type
#define gtk_table_new dynamicgtksyms.gtk_table_new
#define gtk_table_attach dynamicgtksyms.gtk_table_attach
// gtktextbuffer.h
#define gtk_text_buffer_backspace dynamicgtksyms.gtk_text_buffer_backspace
#define gtk_text_buffer_create_mark dynamicgtksyms.gtk_text_buffer_create_mark
@ -576,7 +584,7 @@ void dynamicgtk_uninit(void);
#define gtk_widget_ref dynamicgtksyms.gtk_widget_ref
#define gtk_widget_set_sensitive dynamicgtksyms.gtk_widget_set_sensitive
#define gtk_widget_set_size_request dynamicgtksyms.gtk_widget_set_size_request
#define gtk_widget_show dynamicgtksyms.gtk_widget_show
#define gtk_widget_show_all dynamicgtksyms.gtk_widget_show_all
#define gtk_widget_unref dynamicgtksyms.gtk_widget_unref
// gtkwindow.h

View file

@ -1198,7 +1198,7 @@ void overheadeditor(void)
char buffer[80], *dabuffer, ch;
int32_t i, j, k, m=0, mousxplc, mousyplc, firstx=0, firsty=0, oposz, col;
int32_t tempint, tempint1, tempint2, doubvel;
int32_t startwall=0, endwall, dax, day, daz, x1, y1, x2, y2, x3, y3, x4, y4;
int32_t startwall=0, endwall, dax, day, x1, y1, x2, y2, x3, y3, x4, y4;
int32_t highlightx1, highlighty1, highlightx2, highlighty2, xvect, yvect;
int16_t pag, suckwall=0, sucksect, newnumwalls, newnumsectors, split=0, bad;
int16_t splitsect=0, danumwalls, secondstartwall, joinsector[2], joinsectnum;
@ -1294,7 +1294,6 @@ void overheadeditor(void)
}
}
if (!graphicsmode)
idle();
OSD_DispatchQueued();
@ -1380,6 +1379,8 @@ void overheadeditor(void)
numwalls = newnumwalls;
if (numwalls < 0) numwalls = tempint;
if (keystatus[buildkeys[BK_MOVEUP]] || keystatus[buildkeys[BK_MOVEDOWN]] || mousx || mousy || bstatus || (totalclock & 8) == 0)
{
clear2dscreen();
if (graphicsmode)
@ -1614,6 +1615,7 @@ void overheadeditor(void)
enddrawing(); //}}}
OSD_Draw();
}
X_OnEvent(EVENT_PREKEYS2D, -1);
ExtCheckKeys(); // TX 20050101, it makes more sense to have this here so keys can be overwritten with new functions in bstub.c

View file

@ -93,7 +93,7 @@ void initcache(intptr_t dacachestart, int32_t dacachesize)
// initcache((FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-FP_OFF(pic))&15))&0xfffffff0);
//
// I'm not sure why it's necessary, but the code is making sure the
// cache starts on a multiple of 16 bytes?? -- SA
// cache starts on a multiple of 16 bytes? -- SA
//printf("BEFORE: cachestart = %x, cachesize = %d\n", dacachestart, dacachesize);
cachestart = ((uintptr_t)dacachestart+15)&~(uintptr_t)0xf;

View file

@ -62,9 +62,6 @@ int32_t dynamicgtk_init(void)
GETDLSYM(gtk_container_set_border_width)
GETDLSYM(gtk_dialog_get_type)
GETDLSYM(gtk_dialog_run)
GETDLSYM(gtk_fixed_get_type)
GETDLSYM(gtk_fixed_new)
GETDLSYM(gtk_fixed_put)
GETDLSYM(gtk_hbox_new)
GETDLSYM(gtk_hbutton_box_new)
GETDLSYM(gtk_image_new_from_pixbuf)
@ -95,13 +92,16 @@ int32_t dynamicgtk_init(void)
GETDLSYM(gtk_scrolled_window_new)
GETDLSYM(gtk_scrolled_window_set_policy)
GETDLSYM(gtk_scrolled_window_set_shadow_type)
GETDLSYM(gtk_table_get_type)
GETDLSYM(gtk_table_new)
GETDLSYM(gtk_table_attach)
GETDLSYM(gtk_text_buffer_backspace)
GETDLSYM(gtk_text_buffer_create_mark)
GETDLSYM(gtk_text_buffer_delete_mark)
GETDLSYM(gtk_text_buffer_get_end_iter)
GETDLSYM(gtk_text_buffer_insert)
// FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0)
// around these three, or should I not care??
// around these three, or should I not care?
GETDLSYM(gtk_text_iter_backward_cursor_position)
GETDLSYM(gtk_text_iter_equal)
GETDLSYM(gtk_text_buffer_delete_interactive)
@ -142,7 +142,7 @@ int32_t dynamicgtk_init(void)
GETDLSYM(gtk_widget_ref)
GETDLSYM(gtk_widget_set_sensitive)
GETDLSYM(gtk_widget_set_size_request)
GETDLSYM(gtk_widget_show)
GETDLSYM(gtk_widget_show_all)
GETDLSYM(gtk_widget_unref)
GETDLSYM(gtk_window_add_accel_group)
GETDLSYM(gtk_window_get_type)

View file

@ -1824,7 +1824,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; }
transcol = -1;
while ((chunkind = *ptr++) == '!')
{ //! 0xf9 leng flags ?? ?? transcol
{ //! 0xf9 leng flags ? ? transcol
if (ptr[0] == 0xf9) { if (ptr[2]&1) transcol = (int32_t)(((uint8_t)ptr[5])); }
ptr++;
do { i = *ptr++; ptr += i; }

View file

@ -37,7 +37,7 @@ DEALINGS IN THE SOFTWARE.
/*#define FULLSANITYCHECKS*/
#define USE_ALLOCATOR 1
#define REPLACE_SYSTEM_ALLOCATOR 0
// #define REPLACE_SYSTEM_ALLOCATOR
#define USE_MAGIC_HEADERS 0
#define MAXTHREADSINPOOL 1
#define FINEGRAINEDBINS 1

View file

@ -892,9 +892,8 @@ void polymer_drawmasks(void)
bglEnable(GL_BLEND);
bglEnable(GL_POLYGON_OFFSET_FILL);
while (spritesortcnt)
while (--spritesortcnt)
{
spritesortcnt--;
tspriteptr[spritesortcnt] = &tsprite[spritesortcnt];
polymer_drawsprite(spritesortcnt);
}

View file

@ -1,25 +1,50 @@
/* NOTE: Glade will generate code for a dialogue box which you should
* then patch into this file whenever you make a change to the Glade
* template.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(LINKED_GTK)
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#else
#include "dynamicgtk.h"
#endif
#include "baselayer.h"
#include "compat.h"
#include "build.h"
#include "editor.h"
#define TAB_CONFIG 0
#define TAB_MESSAGES 1
static struct
{
GtkWidget *startwin;
GtkWidget *hlayout;
GtkWidget *banner;
GtkWidget *vlayout;
GtkWidget *tabs;
GtkWidget *configvlayout;
GtkWidget *configtlayout;
GtkWidget *vmode2dlabel;
GtkWidget *vmode3dlabel;
GtkWidget *vmode2dcombo;
GtkWidget *vmode3dcombo;
GtkWidget *fullscreencheck;
GtkWidget *emptyhlayout;
GtkWidget *alwaysshowcheck;
GtkWidget *configtab;
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;
GtkAccelGroup *accel_group;
} stwidgets;
static struct
{
int32_t fullscreen;
@ -28,106 +53,9 @@ static struct
int32_t forcesetup;
} settings;
extern int32_t gtkenabled;
static GtkWidget *startwin = NULL;
static int32_t retval = -1, mode = TAB_MESSAGES;
// -- SUPPORT FUNCTIONS -------------------------------------------------------
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
#define lookup_widget(x,w) \
(GtkWidget*) g_object_get_data(G_OBJECT(x), w)
static GdkPixbuf *load_banner(void)
{
extern const GdkPixdata startbanner_pixdata;
return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
}
static void SetPage(int32_t n)
{
if (!gtkenabled || !startwin) return;
mode = n;
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), 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(lookup_widget(startwin,"startbutton"), n);
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
}
static void on_vmode2dcombo_changed(GtkComboBox *, gpointer);
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
static void PopulateForm(void)
{
int32_t mode2d, mode3d, i;
GtkListStore *modes2d, *modes3d;
GtkTreeIter iter;
GtkComboBox *box2d, *box3d;
char buf[64];
mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1);
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
if (mode2d < 0) mode2d = 0;
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++)
{
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
if (mode3d < 0) continue;
settings.bpp3d = cd[i];
break;
}
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup);
box2d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode2dcombo"));
box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo"));
modes2d = GTK_LIST_STORE(gtk_combo_box_get_model(box2d));
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
gtk_list_store_clear(modes2d);
gtk_list_store_clear(modes3d);
for (i=0; i<validmodecnt; i++)
{
if (validmode[i].fs != settings.fullscreen) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
gtk_list_store_append(modes3d, &iter);
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);
}
// only 8-bit modes get used for 2D
if (validmode[i].bpp != 8 || validmode[i].xdim < 640 || validmode[i].ydim < 480) continue;
Bsprintf(buf, "%d x %d", validmode[i].xdim, validmode[i].ydim);
gtk_list_store_append(modes2d, &iter);
gtk_list_store_set(modes2d, &iter, 0,buf, 1,i, -1);
if (i == mode2d)
{
g_signal_handlers_block_by_func(box2d, on_vmode2dcombo_changed, NULL);
gtk_combo_box_set_active_iter(box2d, &iter);
g_signal_handlers_unblock_by_func(box2d, on_vmode2dcombo_changed, NULL);
}
}
}
extern int32_t gtkenabled;
static void PopulateForm(void);
// -- EVENT CALLBACKS AND CREATION STUFF --------------------------------------
@ -197,303 +125,297 @@ static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpo
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
}
// -- SUPPORT FUNCTIONS -------------------------------------------------------
static GdkPixbuf *load_banner(void)
{
extern const GdkPixdata startbanner_pixdata;
return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
}
static void SetPage(int32_t n)
{
if (!gtkenabled || !stwidgets.startwin) return;
mode = n;
gtk_notebook_set_current_page(GTK_NOTEBOOK(stwidgets.tabs), 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),
(GtkCallback)gtk_widget_set_sensitive,
(gpointer)&n);
}
static void PopulateForm(void)
{
int32_t mode2d, mode3d, i;
GtkListStore *modes2d, *modes3d;
GtkTreeIter iter;
GtkComboBox *box2d, *box3d;
char buf[64];
mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1);
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
if (mode2d < 0) mode2d = 0;
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++)
{
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
if (mode3d < 0) continue;
settings.bpp3d = cd[i];
break;
}
}
box2d = GTK_COMBO_BOX(stwidgets.vmode2dcombo);
box3d = GTK_COMBO_BOX(stwidgets.vmode3dcombo);
modes2d = GTK_LIST_STORE(gtk_combo_box_get_model(box2d));
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
gtk_list_store_clear(modes2d);
gtk_list_store_clear(modes3d);
for (i=0; i<validmodecnt; i++)
{
if (validmode[i].fs != settings.fullscreen) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
gtk_list_store_append(modes3d, &iter);
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);
}
// only 8-bit modes get used for 2D
if (validmode[i].bpp != 8 || validmode[i].xdim < 640 || validmode[i].ydim < 480) continue;
Bsprintf(buf, "%d x %d", validmode[i].xdim, validmode[i].ydim);
gtk_list_store_append(modes2d, &iter);
gtk_list_store_set(modes2d, &iter, 0,buf, 1,i, -1);
if (i == mode2d)
{
g_signal_handlers_block_by_func(box2d, on_vmode2dcombo_changed, NULL);
gtk_combo_box_set_active_iter(box2d, &iter);
g_signal_handlers_unblock_by_func(box2d, on_vmode2dcombo_changed, NULL);
}
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.fullscreen);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.forcesetup);
}
static GtkWidget *create_window(void)
{
GtkWidget *startwin;
GtkWidget *hlayout;
GtkWidget *banner;
GtkWidget *vlayout;
GtkWidget *tabs;
GtkWidget *configvlayout;
GtkWidget *configlayout;
GtkWidget *vmode2dlabel;
GtkWidget *vmode3dlabel;
GtkWidget *vmode2dcombo;
GtkWidget *vmode3dcombo;
GtkWidget *fullscreencheck;
GtkWidget *alwaysshowcheck;
GtkWidget *configtab;
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;
GtkAccelGroup *accel_group;
accel_group = gtk_accel_group_new();
stwidgets.accel_group = gtk_accel_group_new();
// Basic window
startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(startwin), apptitle); // NOTE: use global app title
gtk_window_set_position(GTK_WINDOW(startwin), GTK_WIN_POS_CENTER);
gtk_window_set_resizable(GTK_WINDOW(startwin), FALSE);
gtk_window_set_type_hint(GTK_WINDOW(startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
stwidgets.startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), apptitle); // NOTE: use global app title
gtk_window_set_position(GTK_WINDOW(stwidgets.startwin), GTK_WIN_POS_CENTER);
gtk_window_set_resizable(GTK_WINDOW(stwidgets.startwin), FALSE);
gtk_window_set_type_hint(GTK_WINDOW(stwidgets.startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
// Horizontal layout of banner and controls
hlayout = gtk_hbox_new(FALSE, 0);
gtk_widget_show(hlayout);
gtk_container_add(GTK_CONTAINER(startwin), hlayout);
stwidgets.hlayout = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.startwin), stwidgets.hlayout);
// Banner
// banner
{
GdkPixbuf *pixbuf = load_banner();
banner = gtk_image_new_from_pixbuf(pixbuf);
stwidgets.banner = gtk_image_new_from_pixbuf(pixbuf);
g_object_unref((gpointer)pixbuf);
}
gtk_widget_show(banner);
gtk_box_pack_start(GTK_BOX(hlayout), banner, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(banner), 0.5, 0);
gtk_box_pack_start(GTK_BOX(stwidgets.hlayout), stwidgets.banner, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(stwidgets.banner), 0.5, 0);
// Vertical layout of tab control and start+cancel buttons
vlayout = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vlayout);
gtk_box_pack_start(GTK_BOX(hlayout), vlayout, TRUE, TRUE, 0);
stwidgets.vlayout = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(stwidgets.hlayout), stwidgets.vlayout, TRUE, TRUE, 0);
// Tab control
tabs = gtk_notebook_new();
gtk_widget_show(tabs);
gtk_box_pack_start(GTK_BOX(vlayout), tabs, TRUE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(tabs), 4);
stwidgets.tabs = gtk_notebook_new();
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 main body
configvlayout = gtk_vbox_new(FALSE, 0);
gtk_widget_show(configvlayout);
gtk_container_add(GTK_CONTAINER(tabs), configvlayout);
// Vertical layout of config page
stwidgets.configvlayout = gtk_vbox_new(FALSE, 12);
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.configvlayout);
// Fixed-position layout of config page controls
configlayout = gtk_fixed_new();
gtk_widget_show(configlayout);
gtk_box_pack_start(GTK_BOX(configvlayout), configlayout, TRUE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(configlayout), 6);
// 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);
// 2D video mode label
vmode2dlabel = gtk_label_new_with_mnemonic("_2D Video mode:");
gtk_widget_show(vmode2dlabel);
gtk_fixed_put(GTK_FIXED(configlayout), vmode2dlabel, 0, 0);
gtk_widget_set_size_request(vmode2dlabel, 88, 29);
gtk_misc_set_alignment(GTK_MISC(vmode2dlabel), 0, 0.5);
// 3D video mode label
vmode3dlabel = gtk_label_new_with_mnemonic("_3D Video mode:");
gtk_widget_show(vmode3dlabel);
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dlabel, 0, 32);
gtk_widget_set_size_request(vmode3dlabel, 88, 29);
gtk_misc_set_alignment(GTK_MISC(vmode3dlabel), 0, 0.5);
stwidgets.vmode2dlabel = gtk_label_new_with_mnemonic("_2D Video mode:");
gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode2dlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 6);
// 2D video mode combo
{
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
GtkCellRenderer *cell;
vmode2dcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
stwidgets.vmode2dcombo = 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(vmode2dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode2dcombo), cell, "text", 0, NULL);
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, "text", 0, NULL);
}
gtk_widget_show(vmode2dcombo);
gtk_fixed_put(GTK_FIXED(configlayout), vmode2dcombo, 96, 0);
gtk_widget_set_size_request(vmode2dcombo, 150, 29);
gtk_widget_add_accelerator(vmode2dcombo, "grab_focus", accel_group,
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 6);
gtk_widget_add_accelerator(stwidgets.vmode2dcombo, "grab_focus", stwidgets.accel_group,
GDK_2, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Fullscreen checkbox
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.fullscreencheck, 2,3, 0,1, GTK_FILL, 0, 4, 6);
gtk_widget_add_accelerator(stwidgets.fullscreencheck, "grab_focus", stwidgets.accel_group,
GDK_F, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// 3D video mode label
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_3D Video mode:");
gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 1,2, GTK_FILL, 0, 4, 6);
// 3D video mode combo
{
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
GtkCellRenderer *cell;
vmode3dcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
stwidgets.vmode3dcombo = 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(vmode3dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL);
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_widget_show(vmode3dcombo);
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dcombo, 96, 32);
gtk_widget_set_size_request(vmode3dcombo, 150, 29);
gtk_widget_add_accelerator(vmode3dcombo, "grab_focus", accel_group,
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_widget_add_accelerator(stwidgets.vmode3dcombo, "grab_focus", stwidgets.accel_group,
GDK_3, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Fullscreen checkbox
fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
gtk_widget_show(fullscreencheck);
gtk_fixed_put(GTK_FIXED(configlayout), fullscreencheck, 248, 0);
gtk_widget_set_size_request(fullscreencheck, 85, 29);
gtk_widget_add_accelerator(fullscreencheck, "grab_focus", accel_group,
GDK_F, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// 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);
// Always show config checkbox
alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
gtk_widget_show(alwaysshowcheck);
gtk_box_pack_start(GTK_BOX(configvlayout), alwaysshowcheck, FALSE, FALSE, 0);
gtk_widget_add_accelerator(alwaysshowcheck, "grab_focus", accel_group,
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_widget_add_accelerator(stwidgets.alwaysshowcheck, "grab_focus", stwidgets.accel_group,
GDK_A, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Configuration tab
configtab = gtk_label_new("Configuration");
gtk_widget_show(configtab);
gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 0), configtab);
stwidgets.configtab = gtk_label_new("Configuration");
gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 0), stwidgets.configtab);
// Messages scrollable area
messagesscroll = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(messagesscroll);
gtk_container_add(GTK_CONTAINER(tabs), messagesscroll);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
stwidgets.messagesscroll = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.messagesscroll);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(stwidgets.messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
// Messages text area
messagestext = gtk_text_view_new();
gtk_widget_show(messagestext);
gtk_container_add(GTK_CONTAINER(messagesscroll), messagestext);
gtk_text_view_set_editable(GTK_TEXT_VIEW(messagestext), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(messagestext), GTK_WRAP_WORD);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(messagestext), FALSE);
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(messagestext), 2);
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(messagestext), 2);
stwidgets.messagestext = gtk_text_view_new();
gtk_container_add(GTK_CONTAINER(stwidgets.messagesscroll), stwidgets.messagestext);
gtk_text_view_set_editable(GTK_TEXT_VIEW(stwidgets.messagestext), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(stwidgets.messagestext), GTK_WRAP_WORD);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(stwidgets.messagestext), FALSE);
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(stwidgets.messagestext), 2);
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(stwidgets.messagestext), 2);
// Messages tab
messagestab = gtk_label_new("Messages");
gtk_widget_show(messagestab);
gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 1), messagestab);
stwidgets.messagestab = gtk_label_new("Messages");
gtk_notebook_set_tab_label(GTK_NOTEBOOK(stwidgets.tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(stwidgets.tabs), 1), stwidgets.messagestab);
// Dialogue box buttons layout
buttons = gtk_hbutton_box_new();
gtk_widget_show(buttons);
gtk_box_pack_start(GTK_BOX(vlayout), buttons, FALSE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(buttons), 3);
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons), GTK_BUTTONBOX_END);
stwidgets.buttons = gtk_hbutton_box_new();
gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.buttons, FALSE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.buttons), 3);
gtk_button_box_set_layout(GTK_BUTTON_BOX(stwidgets.buttons), GTK_BUTTONBOX_END);
// Cancel button
cancelbutton = gtk_button_new();
gtk_widget_show(cancelbutton);
gtk_container_add(GTK_CONTAINER(buttons), cancelbutton);
GTK_WIDGET_SET_FLAGS(cancelbutton, GTK_CAN_DEFAULT);
gtk_widget_add_accelerator(cancelbutton, "grab_focus", accel_group,
stwidgets.cancelbutton = gtk_button_new();
gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.cancelbutton);
GTK_WIDGET_SET_FLAGS(stwidgets.cancelbutton, GTK_CAN_DEFAULT);
gtk_widget_add_accelerator(stwidgets.cancelbutton, "grab_focus", stwidgets.accel_group,
GDK_C, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator(cancelbutton, "clicked", accel_group,
gtk_widget_add_accelerator(stwidgets.cancelbutton, "clicked", stwidgets.accel_group,
GDK_Escape, 0,
GTK_ACCEL_VISIBLE);
cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_widget_show(cancelbuttonalign);
gtk_container_add(GTK_CONTAINER(cancelbutton), cancelbuttonalign);
stwidgets.cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.cancelbutton), stwidgets.cancelbuttonalign);
cancelbuttonlayout = gtk_hbox_new(FALSE, 2);
gtk_widget_show(cancelbuttonlayout);
gtk_container_add(GTK_CONTAINER(cancelbuttonalign), cancelbuttonlayout);
stwidgets.cancelbuttonlayout = gtk_hbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(stwidgets.cancelbuttonalign), stwidgets.cancelbuttonlayout);
cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON);
gtk_widget_show(cancelbuttonicon);
gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0);
stwidgets.cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start(GTK_BOX(stwidgets.cancelbuttonlayout), stwidgets.cancelbuttonicon, FALSE, FALSE, 0);
cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel");
gtk_widget_show(cancelbuttonlabel);
gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0);
stwidgets.cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel");
gtk_box_pack_start(GTK_BOX(stwidgets.cancelbuttonlayout), stwidgets.cancelbuttonlabel, FALSE, FALSE, 0);
// Start button
startbutton = gtk_button_new();
gtk_widget_show(startbutton);
gtk_container_add(GTK_CONTAINER(buttons), startbutton);
GTK_WIDGET_SET_FLAGS(startbutton, GTK_CAN_DEFAULT);
gtk_widget_add_accelerator(startbutton, "grab_focus", accel_group,
stwidgets.startbutton = gtk_button_new();
gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.startbutton);
GTK_WIDGET_SET_FLAGS(stwidgets.startbutton, GTK_CAN_DEFAULT);
gtk_widget_add_accelerator(stwidgets.startbutton, "grab_focus", stwidgets.accel_group,
GDK_S, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator(startbutton, "clicked", accel_group,
gtk_widget_add_accelerator(stwidgets.startbutton, "clicked", stwidgets.accel_group,
GDK_Return, 0,
GTK_ACCEL_VISIBLE);
startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_widget_show(startbuttonalign);
gtk_container_add(GTK_CONTAINER(startbutton), startbuttonalign);
stwidgets.startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_container_add(GTK_CONTAINER(stwidgets.startbutton), stwidgets.startbuttonalign);
startbuttonlayout = gtk_hbox_new(FALSE, 2);
gtk_widget_show(startbuttonlayout);
gtk_container_add(GTK_CONTAINER(startbuttonalign), startbuttonlayout);
stwidgets.startbuttonlayout = gtk_hbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(stwidgets.startbuttonalign), stwidgets.startbuttonlayout);
startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON);
gtk_widget_show(startbuttonicon);
gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonicon, FALSE, FALSE, 0);
stwidgets.startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonicon, FALSE, FALSE, 0);
startbuttonlabel = gtk_label_new_with_mnemonic("_Start");
gtk_widget_show(startbuttonlabel);
gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0);
stwidgets.startbuttonlabel = gtk_label_new_with_mnemonic("_Start");
gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonlabel, FALSE, FALSE, 0);
// Wire up the signals
g_signal_connect((gpointer) startwin, "delete_event",
g_signal_connect((gpointer) stwidgets.startwin, "delete_event",
G_CALLBACK(on_startwin_delete_event),
NULL);
g_signal_connect((gpointer) vmode2dcombo, "changed",
g_signal_connect((gpointer) stwidgets.vmode2dcombo, "changed",
G_CALLBACK(on_vmode2dcombo_changed),
NULL);
g_signal_connect((gpointer) vmode3dcombo, "changed",
g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed",
G_CALLBACK(on_vmode3dcombo_changed),
NULL);
g_signal_connect((gpointer) fullscreencheck, "toggled",
g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled",
G_CALLBACK(on_fullscreencheck_toggled),
NULL);
g_signal_connect((gpointer) alwaysshowcheck, "toggled",
g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled",
G_CALLBACK(on_alwaysshowcheck_toggled),
NULL);
g_signal_connect((gpointer) cancelbutton, "clicked",
g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked",
G_CALLBACK(on_cancelbutton_clicked),
NULL);
g_signal_connect((gpointer) startbutton, "clicked",
g_signal_connect((gpointer) stwidgets.startbutton, "clicked",
G_CALLBACK(on_startbutton_clicked),
NULL);
// Associate labels with their controls
gtk_label_set_mnemonic_widget(GTK_LABEL(vmode2dlabel), vmode2dcombo);
gtk_label_set_mnemonic_widget(GTK_LABEL(vmode3dlabel), vmode3dcombo);
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.vmode2dlabel), stwidgets.vmode2dcombo);
gtk_label_set_mnemonic_widget(GTK_LABEL(stwidgets.vmode3dlabel), stwidgets.vmode3dcombo);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF(startwin, startwin, "startwin");
GLADE_HOOKUP_OBJECT(startwin, hlayout, "hlayout");
GLADE_HOOKUP_OBJECT(startwin, banner, "banner");
GLADE_HOOKUP_OBJECT(startwin, vlayout, "vlayout");
GLADE_HOOKUP_OBJECT(startwin, tabs, "tabs");
GLADE_HOOKUP_OBJECT(startwin, configvlayout, "configvlayout");
GLADE_HOOKUP_OBJECT(startwin, configlayout, "configlayout");
GLADE_HOOKUP_OBJECT(startwin, vmode2dlabel, "vmode2dlabel");
GLADE_HOOKUP_OBJECT(startwin, vmode3dlabel, "vmode3dlabel");
GLADE_HOOKUP_OBJECT(startwin, vmode2dcombo, "vmode2dcombo");
GLADE_HOOKUP_OBJECT(startwin, vmode3dcombo, "vmode3dcombo");
GLADE_HOOKUP_OBJECT(startwin, fullscreencheck, "fullscreencheck");
GLADE_HOOKUP_OBJECT(startwin, alwaysshowcheck, "alwaysshowcheck");
GLADE_HOOKUP_OBJECT(startwin, configtab, "configtab");
GLADE_HOOKUP_OBJECT(startwin, messagesscroll, "messagesscroll");
GLADE_HOOKUP_OBJECT(startwin, messagestext, "messagestext");
GLADE_HOOKUP_OBJECT(startwin, messagestab, "messagestab");
GLADE_HOOKUP_OBJECT(startwin, buttons, "buttons");
GLADE_HOOKUP_OBJECT(startwin, cancelbutton, "cancelbutton");
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonalign, "cancelbuttonalign");
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlayout, "cancelbuttonlayout");
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonicon, "cancelbuttonicon");
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlabel, "cancelbuttonlabel");
GLADE_HOOKUP_OBJECT(startwin, startbutton, "startbutton");
GLADE_HOOKUP_OBJECT(startwin, startbuttonalign, "startbuttonalign");
GLADE_HOOKUP_OBJECT(startwin, startbuttonlayout, "startbuttonlayout");
GLADE_HOOKUP_OBJECT(startwin, startbuttonicon, "startbuttonicon");
GLADE_HOOKUP_OBJECT(startwin, startbuttonlabel, "startbuttonlabel");
gtk_window_add_accel_group(GTK_WINDOW(stwidgets.startwin), stwidgets.accel_group);
gtk_window_add_accel_group(GTK_WINDOW(startwin), accel_group);
return startwin;
return stwidgets.startwin;
}
// -- BUILD ENTRY POINTS ------------------------------------------------------
@ -501,13 +423,13 @@ static GtkWidget *create_window(void)
int32_t startwin_open(void)
{
if (!gtkenabled) return 0;
if (startwin) return 1;
if (stwidgets.startwin) return 1;
startwin = create_window();
if (startwin)
stwidgets.startwin = create_window();
if (stwidgets.startwin)
{
SetPage(TAB_MESSAGES);
gtk_widget_show(startwin);
gtk_widget_show_all(stwidgets.startwin);
gtk_main_iteration_do(FALSE);
return 0;
}
@ -517,9 +439,9 @@ int32_t startwin_open(void)
int32_t startwin_close(void)
{
if (!gtkenabled) return 0;
if (!startwin) return 1;
gtk_widget_destroy(startwin);
startwin = NULL;
if (!stwidgets.startwin) return 1;
gtk_widget_destroy(stwidgets.startwin);
stwidgets.startwin = NULL;
return 0;
}
@ -532,8 +454,8 @@ int32_t startwin_puts(const char *str)
const char *aptr, *bptr;
if (!gtkenabled || !str) return 0;
if (!startwin) return 1;
if (!(textview = lookup_widget(startwin, "messagestext"))) return -1;
if (!stwidgets.startwin) return 1;
if (!(textview = stwidgets.messagestext)) return -1;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
@ -579,8 +501,8 @@ int32_t startwin_puts(const char *str)
int32_t startwin_settitle(const char *title)
{
if (!gtkenabled) return 0;
if (!startwin) return 1;
gtk_window_set_title(GTK_WINDOW(startwin), title);
if (!stwidgets.startwin) return 1;
gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), title);
return 0;
}
@ -588,7 +510,7 @@ int32_t startwin_idle(void *s)
{
UNREFERENCED_PARAMETER(s);
if (!gtkenabled) return 0;
//if (!startwin) return 1;
//if (!stwidgets.startwin) return 1;
gtk_main_iteration_do(FALSE);
return 0;
}
@ -596,7 +518,7 @@ int32_t startwin_idle(void *s)
int32_t startwin_run(void)
{
if (!gtkenabled) return 1;
if (!startwin) return 1;
if (!stwidgets.startwin) return 1;
SetPage(TAB_CONFIG);
@ -625,4 +547,3 @@ int32_t startwin_run(void)
return retval;
}

View file

@ -704,12 +704,12 @@ int32_t handleevents(void)
inline void idle(void)
{
Sleep(1);
Sleep(20);
}
inline void idle_waitevent(void)
{
Sleep(1);
Sleep(20);
}
@ -911,7 +911,10 @@ DWORD WINAPI ProcessMouse(LPVOID lpThreadParameter)
(LPDIDEVICEOBJECTDATA)&didod[0], &dwElements, 0);
if (!dwElements || result != DI_OK)
{
Sleep(100);
continue;
}
do
{

View file

@ -292,14 +292,6 @@
RelativePath=".\build\src\mdsprite.c"
>
</File>
<File
RelativePath=".\build\src\mmulti.c"
>
</File>
<File
RelativePath=".\build\src\mmulti_null.c"
>
</File>
<File
RelativePath=".\build\src\mmulti_unstable.c"
>

View file

@ -100,7 +100,7 @@ inline int32_t G_CheckForSpaceCeiling(int32_t sectnum)
inline int32_t G_CheckForSpaceFloor(int32_t sectnum)
{
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0);
return ((sector[sectnum].floorstat&1) && sector[sectnum].floorpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0);
}
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)

View file

@ -491,66 +491,10 @@ void ExtLoadMap(const char *mapname)
{
int32_t i;
int32_t sky=0;
int32_t j;
getmessageleng = 0;
getmessagetimeoff = 0;
// PreCache Wall Tiles
/*
for(j=0;j<numwalls;j++)
if(waloff[wall[j].picnum] == 0)
{
loadtile(wall[j].picnum);
if (bpp != 8)
polymost_precache(wall[j].picnum,wall[j].pal,0);
}
for(j=0;j<numsectors;j++)
if(waloff[sector[j].floorpicnum] == 0 || waloff[sector[j].ceilingpicnum] == 0)
{
loadtile(sector[j].floorpicnum);
loadtile(sector[j].ceilingpicnum);
if (bpp != 8)
{
polymost_precache(sector[j].floorpicnum,sector[j].floorpal,0);
polymost_precache(sector[j].floorpicnum,sector[j].floorpal,0);
}
}
for(j=0;j<numsprites;j++)
if(waloff[sprite[j].picnum] == 0)
{
loadtile(sprite[j].picnum);
if (bpp != 8)
polymost_precache(sprite[j].picnum,sprite[j].pal,1);
}
*/
// Presize Sprites
/*
for (j=numsprites; j>=0; j--)
{
/ * if (tilesizx[sprite[j].picnum]==0 || tilesizy[sprite[j].picnum]==0)
sprite[j].picnum=0; * /
if (sprite[j].picnum>=20 && sprite[j].picnum<=59)
{
if (sprite[j].picnum==26)
{
sprite[j].xrepeat = 8;
sprite[j].yrepeat = 8;
}
else
{
sprite[j].xrepeat = 32;
sprite[j].yrepeat = 32;
}
}
}
*/
Bstrcpy(levelname,mapname);
pskyoff[0]=0;
for (i=0; i<8; i++) pskyoff[i]=0;
@ -3165,7 +3109,7 @@ static int32_t m32gettile(int32_t idInitialTile)
// Start of key handling code //
////////////////////////////////
while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]|(bstatus&1)) == 0) // <- Presumably one of these is escape key ???
while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]|(bstatus&1)) == 0) // <- Presumably one of these is escape key ??
{
DrawTiles(iTopLeftTile, (iTile >= localartlookupnum)?localartlookupnum-1:iTile, nXTiles, nYTiles, ZoomToThumbSize[s_Zoom],moffset);
@ -3330,7 +3274,7 @@ static int32_t m32gettile(int32_t idInitialTile)
iTile = 0;
}
if (iTile >= MAXTILES) // shouldn't this be the count of num tiles ???
if (iTile >= MAXTILES) // shouldn't this be the count of num tiles ??
{
iTile = MAXTILES-1;
}
@ -8653,8 +8597,6 @@ static int32_t osdcmd_quit(const osdfuncparm_t *parm)
uninitengine();
exit(0);
return OSDCMD_OK;
}
static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm)

View file

@ -103,7 +103,7 @@ static FILE *frecfilep = (FILE *)NULL;
static int32_t demo_goalreccnt=0, demo_startreccnt=0, demo_oldsoundtoggle, demo_showstats=1;
static int32_t demo_paused=0;
int32_t g_restorePalette, g_screenCapture;
int32_t g_restorePalette = 0, g_screenCapture = 0;
static int32_t g_noLogoAnim = 0;
static int32_t g_noLogo = 0;
static int32_t g_chatPlayer = -1;
@ -3172,7 +3172,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
if ((spr->cstat&257) != 0) switch (spr->cstat&48)
{
case 0:
break;
// break;
ox = sprx-cposx;
oy = spry-cposy;

View file

@ -874,7 +874,7 @@ skip_check:
vm.g_t[4] = *(intptr_t *)(vm.g_t[5]); // Action
if (vm.g_t[5]) vm.g_t[1] = *(((intptr_t *)vm.g_t[5])+1); // move
vm.g_sp->hitag = *(((intptr_t *)vm.g_t[5])+2); // move flags
vm.g_t[0] = vm.g_t[2] = vm.g_t[3] = 0; // count, actioncount... vm.g_t[3] = ???
vm.g_t[0] = vm.g_t[2] = vm.g_t[3] = 0; // count, actioncount... vm.g_t[3] = ??
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack
continue;
if (vm.g_sp->hitag&random_angle)
@ -2256,6 +2256,8 @@ nullquote:
int32_t j;
#endif
if (g_screenCapture) continue;
if (x1 > x2) swaplong(&x1,&x2);
if (y1 > y2) swaplong(&y1,&y2);
@ -4670,7 +4672,7 @@ void A_LoadActor(int32_t iActor)
{
vm.g_i = iActor; // Sprite ID
vm.g_p = -1; // iPlayer; // Player ID
vm.g_x = -1; // lDist; // ??
vm.g_x = -1; // lDist; // ?
vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure
vm.g_t = &ActorExtra[vm.g_i].temp_data[0]; // Sprite's 'extra' data
vm.g_returnFlag = 0;
@ -4703,7 +4705,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
vm.g_i = iActor; // Sprite ID
vm.g_p = iPlayer; // Player ID
vm.g_x = lDist; // ??
vm.g_x = lDist; // ?
vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure
vm.g_t = &ActorExtra[vm.g_i].temp_data[0]; // Sprite's 'extra' data
vm.g_returnFlag = 0;

View file

@ -40,7 +40,7 @@ static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */
// AddLog("Gv_Free");
for (; i>=0; i--)
{
if (aGameVars[i].dwFlags & (GAMEVAR_USER_MASK) && aGameVars[i].val.plValues)
if ((aGameVars[i].dwFlags & GAMEVAR_USER_MASK) && aGameVars[i].val.plValues)
{
Bfree(aGameVars[i].val.plValues);
aGameVars[i].val.plValues=NULL;
@ -73,7 +73,7 @@ static void Gv_Clear(void)
aGameVars[i].szLabel=NULL;
aGameVars[i].dwFlags=0;
if (aGameVars[i].dwFlags & (GAMEVAR_USER_MASK) && aGameVars[i].val.plValues)
if ((aGameVars[i].dwFlags & GAMEVAR_USER_MASK) && aGameVars[i].val.plValues)
{
Bfree(aGameVars[i].val.plValues);
aGameVars[i].val.plValues=NULL;
@ -292,7 +292,7 @@ void Gv_WriteSave(FILE *fil)
}
else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR)
{
dfwrite(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXSPRITES, 1, fil);
dfwrite(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil);
}
}
}
@ -587,7 +587,7 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis
case 2: //else if (id == g_iWallVarID)
return ((X_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
default:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF??\n",g_errorLineNum,keyw[g_tw]);
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
}
@ -732,7 +732,7 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
case 2: //else if (id == g_iWallVarID)
return ((X_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
default:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF??\n",g_errorLineNum,keyw[g_tw]);
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]);
return -1;
}
}

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
const char *s_buildDate = "20091017";
const char *s_buildDate = "20091106";
char *MusicPtr = NULL;
int32_t g_musicSize;

View file

@ -1605,7 +1605,7 @@ static int32_t C_ParseCommand(void)
if (nsize == osize)
{
int ii, equal=2, linedif, ow, nw;
int ii, equal=2, linedif = 0, ow, nw;
for (ii=0; ii<nsize; ii++)
{
@ -1798,7 +1798,7 @@ static int32_t C_ParseCommand(void)
if (osize == nsize)
{
int ii, equal=2, linedif, nw, ow;
int ii, equal=2, linedif=0, nw, ow;
for (ii=0; ii<nsize; ii++)
{

View file

@ -1224,8 +1224,15 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
return r;
}
else if (!Bstrcasecmp(parm->name, "skill"))
{
if (numplayers > 1)
return r;
ud.m_player_skill = ud.player_skill;
return r;
}
}
#endif
@ -1290,6 +1297,8 @@ int32_t registerosdcommands(void)
{ "sensitivity","sensitivity <value>: changes the mouse sensitivity", (void*)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 0, 25 },
{ "skill","skill <value>: changes the game skill setting", (void*)&ud.player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOMULTI, 0, 0, 5 },
{ "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void*)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 0, 1 },
{ "snd_duketalk", "snd_duketalk: enables/disables Duke's speech", (void*)&ud.config.VoiceToggle, CVAR_INT, 0, 0, 5 },
{ "snd_fxvolume", "snd_fxvolume: volume of sound effects", (void*)&ud.config.FXVolume, CVAR_INT, 0, 0, 255 },

View file

@ -4831,13 +4831,12 @@ void P_ProcessInput(int32_t snum)
if ((truefdist < PHEIGHT+(8<<8)) && (k == 1 || k == 3))
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
if (p->walking_snd_toggle == 0 && p->on_ground)
{
switch (psectlotag)
{
case 0:
if (lz >= 0 && (lz&(MAXSPRITES-1))==49152)
if (lz >= 0 && (lz&49152) == 49152)
j = sprite[lz&(MAXSPRITES-1)].picnum;
else j = sector[psect].floorpicnum;
@ -4850,10 +4849,14 @@ void P_ProcessInput(int32_t snum)
break;
}
break;
case 1:
if (!p->spritebridge)
{
if ((krand()&1) == 0)
A_PlaySound(DUKE_ONWATER,pi);
p->walking_snd_toggle = 1;
}
break;
}
}

View file

@ -453,7 +453,7 @@ void G_CacheMapData(void)
{
tloadtile(sector[i].floorpicnum, 0);
tloadtile(sector[i].ceilingpicnum, 0);
if (sector[i].ceilingpicnum == LA) // JBF 20040509: if( waloff[sector[i].ceilingpicnum] == LA) WTF??!??!?!?
if (sector[i].ceilingpicnum == LA) // JBF 20040509: if( waloff[sector[i].ceilingpicnum] == LA) WTF?!?!?!?
{
tloadtile(LA+1, 0);
tloadtile(LA+2, 0);
@ -1211,7 +1211,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
DukePlayer_t *p = g_player[0].ps;
int32_t i;
if (!premap_quickenterlevel)
if (premap_quickenterlevel)
goto quick;
handleevents();

File diff suppressed because it is too large Load diff