Jordi Mallach: supress compile warnings, update copyright notices.
+2003-01-07 Jordi Mallach <jordi@sindominio.net>
+
+ * src/client.c: supress compile warnings.
+ * src/commands.c: likewise.
+ * src/dialogs.c: likewise.
+ * src/fields.c: likewise.
+ * src/gtetrinet.c: likewise.
+ * src/misc.c: likewise.
+ * src/partyline.c: likewise.
+ * src/sound.c: likewise.
+ * src/tetrinet.c: likewise.
+ * src/tetris.c: likewise.
+
+ * src/*.c: update dates in copyright notices.
+
2003-01-07 Dani Carbonell <bocata@panete.net>
- * dialogs.c: rewrite the team change dialog, using gtk_window_new and
- making it HIG compliant.
+ * dialogs.c (teamdialog_new): complete rewrite of this dialog, so it
+ is now HIG compliant.
+ (prefdialog_new): added spacing between buttons.
+ (connectdialog_new): likewise.
+ (connectdialog_button): check if user has specified a servername, a
+ nickname and a spectator password before trying to connect.
+ (key_dialog_callback): converted the key stroke to upper case.
+
+ * tetrinet.c (tetrinet_key): now it converts all keystrokes to upper
+ case.
+
+ * config.c (config_loadconfig): likewise
2003-01-06 Jordi Mallach <jordi@sindominio.net>
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
{0, 0}
};
-static void client_inputfunc (gpointer data, gint source,
- GdkInputCondition condition);
+static void client_inputfunc (void);
/* functions which set up the connection */
static void client_process (void);
}
/* a function that reads stuff from the pipe */
-static void client_inputfunc (gpointer data, gint source,
- GdkInputCondition condition)
+static void client_inputfunc (void)
{
char buf[1024];
char *token;
GString *s2 = g_string_sized_new(80);
unsigned char ip[4];
GString *iphashbuf = g_string_sized_new(11);
- int i, l, len;
+ unsigned int i, len;
+ int l;
/* construct message */
if (gamemode == TETRIFAST)
/* callbacks */
-void connect_command (GtkWidget *widget, gpointer data)
+void connect_command (void)
{
connectdialog_new ();
}
-void disconnect_command (GtkWidget *widget, gpointer data)
+void disconnect_command (void)
{
client_destroy ();
}
-void team_command (GtkWidget *widget, gpointer data)
+void team_command (void)
{
teamdialog_new ();
}
#ifdef ENABLE_DETACH
-void detach_command (GtkWidget *widget, gpointer data)
+void detach_command (void)
{
move_current_page_to_window ();
}
#endif
-void start_command (GtkWidget *widget, gpointer data)
+void start_command (void)
{
char buf[22];
g_snprintf (buf, sizeof(buf), "%i %i", 1, playernum);
client_outmessage (OUT_STARTGAME, buf);
}
-void end_command (GtkWidget *widget, gpointer data)
+void end_command (void)
{
char buf[22];
g_snprintf (buf, sizeof(buf), "%i %i", 0, playernum);
client_outmessage (OUT_STARTGAME, buf);
}
-void pause_command (GtkWidget *widget, gpointer data)
+void pause_command (void)
{
char buf[22];
g_snprintf (buf, sizeof(buf), "%i %i", paused?0:1, playernum);
client_outmessage (OUT_PAUSE, buf);
}
-void preferences_command (GtkWidget *widget, gpointer data)
+void preferences_command (void)
{
prefdialog_new ();
}
/* about... */
-void about_command (GtkWidget *widget, gpointer data)
+void about_command (void)
{
GtkWidget *hbox;
GdkPixbuf *logo;
void make_menus (GnomeApp *app);
-void connect_command (GtkWidget *widget, gpointer data);
-void disconnect_command (GtkWidget *widget, gpointer data);
-void team_command (GtkWidget *widget, gpointer data);
+void connect_command (void);
+void disconnect_command (void);
+void team_command (void);
#ifdef ENABLE_DETACH
-void detach_command (GtkWidget *widget, gpointer data);
+void detach_command (void);
#endif
-void start_command (GtkWidget *widget, gpointer data);
-void end_command (GtkWidget *widget, gpointer data);
-void pause_command (GtkWidget *widget, gpointer data);
-void preferences_command (GtkWidget *widget, gpointer data);
-void about_command (GtkWidget *widget, gpointer data);
+void start_command (void);
+void end_command (void);
+void pause_command (void);
+void preferences_command (void);
+void about_command (void);
void commands_checkstate (void);
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
"Sounds/GameStart",
};
-gint defaultkeys[K_NUM] = {
+guint defaultkeys[K_NUM] = {
GDK_Right,
GDK_Left,
GDK_Up,
GDK_Control_R,
GDK_Down,
GDK_space,
- GDK_d,
- GDK_t
+ GDK_D,
+ GDK_T
};
-gint keys[K_NUM];
+guint keys[K_NUM];
/* themedir is assumed to have a trailing slash */
void config_loadtheme (char *themedir)
}
k = gnome_config_get_int ("Keys/Right");
- keys[K_RIGHT] = k ? k : defaultkeys[K_RIGHT];
+ keys[K_RIGHT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_RIGHT]);
k = gnome_config_get_int ("Keys/Left");
- keys[K_LEFT] = k ? k : defaultkeys[K_LEFT];
+ keys[K_LEFT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_LEFT]);
k = gnome_config_get_int ("Keys/RotateRight");
- keys[K_ROTRIGHT] = k ? k : defaultkeys[K_ROTRIGHT];
+ keys[K_ROTRIGHT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_ROTRIGHT]);
k = gnome_config_get_int ("Keys/RotateLeft");
- keys[K_ROTLEFT] = k ? k : defaultkeys[K_ROTLEFT];
+ keys[K_ROTLEFT] = gdk_keyval_to_upper (k ? k : defaultkeys[K_ROTLEFT]);
k = gnome_config_get_int ("Keys/Down");
- keys[K_DOWN] = k ? k : defaultkeys[K_DOWN];
+ keys[K_DOWN] = gdk_keyval_to_upper (k ? k : defaultkeys[K_DOWN]);
k = gnome_config_get_int ("Keys/Drop");
- keys[K_DROP] = k ? k : defaultkeys[K_DROP];
+ keys[K_DROP] = gdk_keyval_to_upper (k ? k : defaultkeys[K_DROP]);
k = gnome_config_get_int ("Keys/Discard");
- keys[K_DISCARD] = k ? k : defaultkeys[K_DISCARD];
+ keys[K_DISCARD] = gdk_keyval_to_upper (k ? k : defaultkeys[K_DISCARD]);
k = gnome_config_get_int ("Keys/Message");
- keys[K_GAMEMSG] = k ? k : defaultkeys[K_GAMEMSG];
+ keys[K_GAMEMSG] = gdk_keyval_to_upper (k ? k : defaultkeys[K_GAMEMSG]);
gnome_config_pop_prefix ();
extern char blocksfile[1024];
extern int bsize;
extern char currenttheme[1024];
-extern gint keys[];
-extern gint defaultkeys[];
+extern guint keys[];
+extern guint defaultkeys[];
extern void config_loadtheme (char *themedir);
extern int config_getthemeinfo (char *themedir, char *name, char *author, char *desc);
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
GtkWidget *team_dialog;
-void connectingdialog_button (GnomeDialog *dialog, gint button, gpointer data)
+void connectingdialog_button (GnomeDialog *dialog, gint button)
{
+ dialog = dialog;
switch (button) {
case 0:
gtk_timeout_remove (timeouttag);
}
}
-gint connectingdialog_delete (GtkWidget *widget, gpointer data)
+gint connectingdialog_delete (void)
{
return TRUE; /* dont kill me */
}
-gint connectingdialog_timeout (gpointer data)
+gint connectingdialog_timeout (void)
{
GtkAdjustment *adj;
adj = GTK_PROGRESS(progressbar)->adjustment;
/*******************/
/* the team dialog */
/*******************/
-void teamdialog_destroy (GtkWidget *widget, gpointer data)
+void teamdialog_destroy (void)
{
gtk_widget_destroy (team_dialog);
team_dialog = NULL;
}
+
void teamdialog_button (GtkWidget *button, gpointer data)
{
- GtkWidget *entry = GTK_WIDGET(data);
+ GtkEntry *entry = GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (data)));
gchar *aux;
- aux = g_locale_from_utf8 (gtk_entry_get_text(GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(entry)))), -1, NULL, NULL, NULL);
+ button = button; /* so we get no unused parameter warning */
+
+ aux = g_locale_from_utf8 (gtk_entry_get_text (entry), -1, NULL, NULL, NULL);
tetrinet_changeteam (aux);
- teamdialog_destroy (NULL, NULL);
+ teamdialog_destroy ();
g_free (aux);
}
gtk_window_set_resizable (GTK_WINDOW (team_dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (team_dialog), 12);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_vbox_new (TRUE, 6);
gtk_container_add (GTK_CONTAINER (team_dialog), vbox);
/* button box*/
- buttonbox = gtk_hbox_new (TRUE, 6);
+ buttonbox = gtk_hbutton_box_new ();
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonbox), GTK_BUTTONBOX_END);
+ gtk_box_set_spacing (GTK_BOX (buttonbox), 6);
cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_box_pack_start_defaults (GTK_BOX (buttonbox), cancel_button);
ok_button = gtk_button_new_from_stock (GTK_STOCK_OK);
widget = gtk_label_new (_("Team name:"));
gtk_box_pack_start_defaults (GTK_BOX (hbox), widget);
entry = gnome_entry_new ("Team");
- gtk_entry_set_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(entry))),
+ gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))),
team_utf8);
g_free (team_utf8);
gtk_box_pack_start_defaults (GTK_BOX (hbox), entry);
static GSList *gametypegroup;
static int oldgamemode;
-void connectdialog_button (GnomeDialog *dialog, gint button, gpointer data)
+void connectdialog_button (GnomeDialog *dialog, gint button)
{
gchar *team_utf8, *nick; /* intermediate buffer for recoding purposes */
+
switch (button) {
case 1:
/* connect now */
+ if (strlen (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry))))) <= 0)
+ {
+ gnome_error_dialog_parented (_("You must specify a server name."), GTK_WINDOW (dialog));
+ return;
+ }
+
spectating = GTK_TOGGLE_BUTTON(spectatorcheck)->active ? TRUE : FALSE;
- GTET_O_STRCPY (specpassword, gtk_entry_get_text (GTK_ENTRY(passwordentry)));
+ if (spectating)
+ {
+ GTET_O_STRCPY (specpassword, gtk_entry_get_text (GTK_ENTRY(passwordentry)));
+ if (strlen (specpassword) <= 0)
+ {
+ gnome_error_dialog_parented (_("Please specify a password to connect as spectator."), GTK_WINDOW (dialog));
+ return;
+ }
+ }
+
team_utf8 = g_locale_from_utf8 (gtk_entry_get_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(teamnameentry)))),
-1, NULL, NULL, NULL);
GTET_O_STRCPY (team, team_utf8);
- nick = g_locale_from_utf8 (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (nicknameentry)))),
+
+ nick = g_locale_from_utf8 (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (nicknameentry)))),
-1, NULL, NULL, NULL);
- client_init (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry)))), nick);
+ g_strstrip (nick); /* we remove leading and trailing whitespaces */
+ if (strlen (nick) > 0)
+ client_init (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (serveraddressentry)))), nick);
+ else
+ gnome_error_dialog_parented (_("Please specify a valid nickname."), GTK_WINDOW (dialog));
+
g_free (team_utf8);
g_free (nick);
break;
}
}
-void connectdialog_spectoggle (GtkWidget *widget, gpointer data)
+void connectdialog_spectoggle (GtkWidget *widget)
{
if (GTK_TOGGLE_BUTTON(widget)->active) {
gtk_widget_set_sensitive (passwordentry, TRUE);
}
}
-void connectdialog_originaltoggle (GtkWidget *widget, gpointer data)
+void connectdialog_originaltoggle (GtkWidget *widget)
{
if (GTK_TOGGLE_BUTTON(widget)-> active) {
gamemode = ORIGINAL;
}
}
-void connectdialog_tetrifasttoggle (GtkWidget *widget, gpointer data)
+void connectdialog_tetrifasttoggle (GtkWidget *widget)
{
if (GTK_TOGGLE_BUTTON(widget)-> active) {
gamemode = TETRIFAST;
gtk_widget_destroy (connectdialog);
}
-void connectdialog_destroy (GtkWidget *widget, gpointer data)
+void connectdialog_destroy (void)
{
connecting = FALSE;
}
gtk_box_pack_start (GTK_BOX(GNOME_DIALOG(connectdialog)->vbox),
table1, TRUE, TRUE, 0);
+ gtk_box_set_spacing (GTK_BOX (GNOME_DIALOG (connectdialog)->action_area), 6);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(spectatorcheck), spectating);
- connectdialog_spectoggle (spectatorcheck, NULL);
+ connectdialog_spectoggle (spectatorcheck);
g_signal_connect (G_OBJECT(connectdialog), "destroy",
GTK_SIGNAL_FUNC(connectdialog_destroy), NULL);
g_signal_connect (G_OBJECT(spectatorcheck), "toggled",
void key_dialog_callback (GtkWidget *widget, GdkEventKey *key)
{
- keydialog_key = key->keyval;
+ keydialog_key = gdk_keyval_to_upper (key->keyval);
gnome_dialog_close (GNOME_DIALOG(widget));
}
K_GAMEMSG
};
-gint newkeys[K_NUM];
+guint newkeys[K_NUM];
struct themelistentry {
char dir[1024];
int themecount;
int theme_select;
-void prefdialog_destroy (GtkWidget *widget, gpointer data)
+void prefdialog_destroy (void)
{
gtk_widget_destroy (prefdialog);
prefdialog = NULL;
}
}
-void prefdialog_restorekeys (GtkWidget *widget, gpointer data)
+void prefdialog_restorekeys (void)
{
int i;
gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
}
-void prefdialog_changekey (GtkWidget *widget, gpointer data)
+void prefdialog_changekey (void)
{
gchar buf[256], *key;
gint k, row = 0;
prefdialog_midioff ();
}
-void prefdialog_soundtoggle (GtkWidget *widget, gpointer data)
+void prefdialog_soundtoggle (GtkWidget *widget)
{
if (GTK_TOGGLE_BUTTON(widget)->active) {
prefdialog_soundon ();
gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
}
-void prefdialog_miditoggle (GtkWidget *widget, gpointer data)
+void prefdialog_miditoggle (GtkWidget *widget)
{
if (GTK_TOGGLE_BUTTON(widget)->active) {
prefdialog_midion ();
}
-void prefdialog_midichanged (GtkWidget *widget, gpointer data)
+void prefdialog_midichanged (void)
{
midichanged = TRUE;
gnome_property_box_changed (GNOME_PROPERTY_BOX(prefdialog));
}
-void prefdialog_restoremidi (GtkWidget *widget, gpointer data)
+void prefdialog_restoremidi (void)
{
gtk_entry_set_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(midientry))),
DEFAULTMIDICMD);
leftlabel_set (desclabel, desc);
}
-void prefdialog_themeselect (GtkTreeSelection *treeselection,
- gpointer data)
+void prefdialog_themeselect (GtkTreeSelection *treeselection)
{
GtkListStore *model;
GtkTreeIter iter;
void prefdialog_apply (GnomePropertyBox *dialog, gint pagenum)
{
int i;
-
+
+ dialog = dialog;
+
if (pagenum == -1) {
for (i = 0; i < K_NUM; i ++) {
keys[i] = newkeys[i];
}
}
-void prefdialog_ok (GtkWidget *widget, gpointer data)
+void prefdialog_ok (void)
{
prefdialog_apply (NULL, -1);
gtk_widget_destroy (prefdialog);
GtkListStore *theme_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
GtkListStore *keys_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- GtkTreeSelection *theme_selection, *keys_selection;
+ GtkTreeSelection *theme_selection;
int i;
if (prefdialog != NULL)
#endif
themechanged = midichanged = FALSE;
+
+ gtk_box_set_spacing (GTK_BOX (GNOME_DIALOG (prefdialog)->action_area), 6);
g_signal_connect (G_OBJECT(soundcheck), "toggled",
GTK_SIGNAL_FUNC(prefdialog_soundtoggle), NULL);
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static GtkWidget *fields_page_contents (void);
static gint fields_expose_event (GtkWidget *widget, GdkEventExpose *event, int field);
-static gint fields_nextpiece_expose (GtkWidget *widget, GdkEventExpose *event);
-static gint fields_specials_expose (GtkWidget *widget, GdkEventExpose *event);
+static gint fields_nextpiece_expose (void);
+static gint fields_specials_expose (void);
static void fields_refreshfield (int field);
static void fields_drawblock (int field, int x, int y, char block);
-static gint fields_eatkey (GtkWidget *widget, GdkEventKey *key);
+static gint fields_eatkey (GtkWidget *widget);
static GdkPixmap *blockpix;
gint fields_expose_event (GtkWidget *widget, GdkEventExpose *event, int field)
{
+ widget = widget;
+ event = event;
fields_refreshfield (field);
return FALSE;
}
}
-gint fields_nextpiece_expose (GtkWidget *widget, GdkEventExpose *event)
+gint fields_nextpiece_expose (void)
{
fields_drawnextblock (NULL);
return FALSE;
}
-gint fields_specials_expose (GtkWidget *widget, GdkEventExpose *event)
+gint fields_specials_expose (void)
{
fields_drawspecials ();
return FALSE;
return gtk_entry_get_text (GTK_ENTRY(gmsginput));
}
-gint fields_eatkey (GtkWidget *widget, GdkEventKey *key)
+gint fields_eatkey (GtkWidget *widget)
{
gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key-press-event");
return TRUE;
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static GtkWidget *pixmapdata_label (char **d, char *str);
static int gtetrinet_key (int keyval, int mod);
-gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data);
-gint keyrelease (GtkWidget *widget, GdkEventKey *key, gpointer data);
+gint keypress (GtkWidget *widget, GdkEventKey *key);
+gint keyrelease (GtkWidget *widget, GdkEventKey *key);
static GtkWidget *app, *pfields, *pparty, *pwinlist;
static GtkWidget *winlistwidget, *partywidget, *fieldswidget;
int main (int argc, char *argv[])
{
- GtkWidget *page, *label, *box;
- char buf[1024], *logo;
+ GtkWidget *label;
+ char buf[1024];
GdkPixbuf *icon_pixbuf;
GTET_STRCPY(buf, "", 4);
}
/* called when the main window is destroyed */
-void destroymain (GtkWidget *widget, gpointer data)
+void destroymain (void)
{
gtk_main_quit ();
}
gint keytimeout (gpointer data)
{
+ data = data; /* to get rid of the warning */
tetrinet_upkey (k.keyval);
keytimeoutid = 0;
return FALSE;
}
-gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data)
+gint keypress (GtkWidget *widget, GdkEventKey *key)
{
int game_area;
return FALSE;
}
-gint keyrelease (GtkWidget *widget, GdkEventKey *key, gpointer data)
+gint keyrelease (GtkWidget *widget, GdkEventKey *key)
{
int game_area;
void destroy_page_window (GtkWidget *window, gpointer data)
{
WidgetPageData *pageData = (WidgetPageData *)data;
+ window = window;
/* Put widget back into a page */
gtk_widget_reparent (pageData->widget, pageData->parent);
extern int gamemode;
-extern void destroymain (GtkWidget *widget, gpointer data);
-extern gint keypress (GtkWidget *widget, GdkEventKey *key, gpointer data);
-extern gint keyrelease (GtkWidget *widget, GdkEventKey *key, gpointer data);
+extern void destroymain (void);
+extern gint keypress (GtkWidget *widget, GdkEventKey *key);
+extern gint keyrelease (GtkWidget *widget, GdkEventKey *key);
extern void move_current_page_to_window (void);
extern void show_fields_page (void);
extern void show_partyline_page (void);
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
void textbox_addtext (GtkTextView *textbox, unsigned char *text)
{
GtkTextTag *color, *lastcolor;
- int attr; /* bits are used as flags: bold, italic */
int i;
/* int bottom; */
char last = 0;
{
GList *scan = adj_list;
+ data = data; /* to get rid of the warning */
+
while (scan)
{
GtkTextView *tv = scan->data;
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int plh_start = 0, plh_end = 0, plh_cur = 0;
/* function prototypes for callbacks */
-static void textentry (GtkWidget *widget, gpointer data);
+static void textentry (GtkWidget *widget);
static gint entrykey (GtkWidget *widget, GdkEventKey *key);
GtkWidget *partyline_page_new (void)
GtkWidget *widget, *box; /* generic temp variables */
GtkListStore *playerlist_model = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- char *listtitles[3];
/* left box */
leftbox = gtk_vbox_new (FALSE, 4);
{
int i;
char buf0[16], buf1[128], buf2[128];
- char *item[3] = {buf0, buf1, buf2};
GtkListStore *playerlist_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (playerlist)));
GtkTreeIter iter;
gchar *aux1, *aux2; /* for recoding purposes */
if (connected) gtk_widget_grab_focus (entrybox);
}
-void textentry (GtkWidget *widget, gpointer data)
+void textentry (GtkWidget *widget)
{
const char *text;
gchar *iso_text;
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* stubs */
void sound_cache (void) {}
-void sound_playsound (int id) {}
-void sound_playmidi (char *file) {}
+void sound_playsound (int id) {id = id;}
+void sound_playmidi (char *file) {file = file;}
void sound_stopmidi (void) {}
#endif
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* tetrisy stuff */
/*****************/
static void tetrinet_settimeout (int duration);
-static gint tetrinet_timeout (gpointer data);
+static gint tetrinet_timeout (void);
static void tetrinet_solidify (void);
static void tetrinet_nextblock (void);
-static gint tetrinet_nextblocktimeout (gpointer data);
+static gint tetrinet_nextblocktimeout (void);
static int tetrinet_removelines (void);
-static gint tetrinet_removelinestimeout (gpointer data);
+static gint tetrinet_removelinestimeout (void);
TETRISBLOCK blankblock =
{ {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} };
movedowntimeout = 0;
}
-gint tetrinet_timeout (gpointer data)
+gint tetrinet_timeout (void)
{
if (paused) return TRUE;
if (!playing) return FALSE;
NULL);
}
-gint tetrinet_nextblocktimeout (gpointer data)
+gint tetrinet_nextblocktimeout (void)
{
if (paused) return TRUE; /* come back later */
if (!playing) return FALSE;
return sound;
}
-gint tetrinet_removelinestimeout (gpointer data)
+gint tetrinet_removelinestimeout (void)
{
tetris_drawcurrentblock ();
return FALSE;
}
return TRUE;
}
- if (keyval == keys[K_GAMEMSG]) {
+ if (gdk_keyval_to_upper (keyval) == keys[K_GAMEMSG]) {
fields_gmsginput (TRUE);
gmsgstate = 1;
return TRUE;
}
if (paused || !playing) return FALSE;
/* game keys */
- if (keyval == keys[K_ROTRIGHT]) {
+ if (gdk_keyval_to_upper (keyval) == keys[K_ROTRIGHT]) {
if (!nextblocktimeout)
sound_playsound (S_ROTATE);
tetris_blockrotate (1);
}
- else if (keyval == keys[K_ROTLEFT]) {
+ else if (gdk_keyval_to_upper (keyval) == keys[K_ROTLEFT]) {
if (!nextblocktimeout)
sound_playsound (S_ROTATE);
tetris_blockrotate (-1);
}
- else if (keyval == keys[K_RIGHT]) {
+ else if (gdk_keyval_to_upper (keyval) == keys[K_RIGHT]) {
tetris_blockmove (1);
}
- else if (keyval == keys[K_LEFT]) {
+ else if (gdk_keyval_to_upper (keyval) == keys[K_LEFT]) {
tetris_blockmove (-1);
}
- else if (keyval == keys[K_DOWN]) {
+ else if (gdk_keyval_to_upper (keyval) == keys[K_DOWN]) {
if (!downpressed) {
- tetrinet_timeout (NULL);
+ tetrinet_timeout ();
downpressed = 1;
tetrinet_settimeout (DOWNDELAY);
}
}
- else if (keyval == keys[K_DROP]) {
+ else if (gdk_keyval_to_upper (keyval) == keys[K_DROP]) {
int sound;
if (!nextblocktimeout) {
tetris_blockdrop ();
tetrinet_sendfield (0);
}
}
- else if (keyval == keys[K_DISCARD]) {
+ else if (gdk_keyval_to_upper (keyval) == keys[K_DISCARD]) {
tetrinet_specialkey(-1);
}
else switch (keyval) {
void tetrinet_upkey (int keyval)
{
if (!playing) return;
- if (keyval == keys[K_DOWN]) {
+ if (gdk_keyval_to_upper (keyval) == keys[K_DOWN]) {
/* if it is a quick press, nudge it down one more step */
- if (downpressed == 1) tetrinet_timeout (NULL);
+ if (downpressed == 1) tetrinet_timeout ();
downpressed = 0;
tetrinet_settimeout (tetrinet_timeoutduration());
}
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
void tetris_addlines (int count, int type)
{
- int x, y, n, i;
+ int x, y, i;
FIELD field;
copyfield (field, fields[playernum]);
for (i = 0; i < count; i ++) {
/*
* GTetrinet
- * Copyright (C) 1999, 2000 Ka-shu Wong (kswong@zip.com.au)
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Ka-shu Wong (kswong@zip.com.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by