From 73d6165280d58c56c6bd875fff56bc1cda0198ac Mon Sep 17 00:00:00 2001 From: mcmartin Date: Sun, 12 Nov 2006 05:58:18 +0000 Subject: [PATCH] Skeleton for pre-connect configuration dialog git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2497 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/msvc++/UrQuanMasters.dsp | 8 ++++ sc2/src/sc2code/Makeinfo | 6 +-- sc2/src/sc2code/cnctdlg.c | 65 ++++++++++++++++++++++++++++++++ sc2/src/sc2code/cnctdlg.h | 31 +++++++++++++++ sc2/src/sc2code/melee.c | 11 +++++- 5 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 sc2/src/sc2code/cnctdlg.c create mode 100644 sc2/src/sc2code/cnctdlg.h diff --git a/sc2/src/msvc++/UrQuanMasters.dsp b/sc2/src/msvc++/UrQuanMasters.dsp index 31026779c..2b016824e 100644 --- a/sc2/src/msvc++/UrQuanMasters.dsp +++ b/sc2/src/msvc++/UrQuanMasters.dsp @@ -3857,6 +3857,14 @@ SOURCE=..\sc2code\clock.h # End Source File # Begin Source File +SOURCE=..\sc2code\cnctdlg.c +# End Source File +# Begin Source File + +SOURCE=..\sc2code\cnctdlg.h +# End Source File +# Begin Source File + SOURCE=..\sc2code\coderes.h # End Source File # Begin Source File diff --git a/sc2/src/sc2code/Makeinfo b/sc2/src/sc2code/Makeinfo index 269a25907..69503e179 100644 --- a/sc2/src/sc2code/Makeinfo +++ b/sc2/src/sc2code/Makeinfo @@ -1,7 +1,7 @@ uqm_SUBDIRS="comm libs planets ships" -uqm_CFILES="battle.c border.c build.c cleanup.c clock.c collide.c comm.c - commanim.c commglue.c confirm.c credits.c cyborg.c demo.c - displist.c dummy.c encount.c fmv.c galaxy.c gameev.c +uqm_CFILES="battle.c border.c build.c cleanup.c clock.c cnctdlg.c collide.c + comm.c commanim.c commglue.c confirm.c credits.c cyborg.c + demo.c displist.c dummy.c encount.c fmv.c galaxy.c gameev.c gameinp.c gameopt.c gendef.c getchar.c globdata.c gravity.c gravwell.c grpinfo.c hyper.c init.c intel.c intro.c ipdisp.c load.c loadship.c master.c melee.c menu.c misc.c mouse_err.c diff --git a/sc2/src/sc2code/cnctdlg.c b/sc2/src/sc2code/cnctdlg.c new file mode 100644 index 000000000..736d67bed --- /dev/null +++ b/sc2/src/sc2code/cnctdlg.c @@ -0,0 +1,65 @@ +//Copyright Michael Martin, 2006 + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef NETPLAY + +#include "cnctdlg.h" +#include "controls.h" + +typedef struct connect_dialog_state +{ + BOOLEAN (*InputFunc) (struct connect_dialog_state *pInputState); + COUNT MenuRepeatDelay; + + BOOLEAN Initialized; + int which_side; + + int option; +} CONNECT_DIALOG_STATE; + +typedef CONNECT_DIALOG_STATE *PCONNECT_DIALOG_STATE; + +static BOOLEAN +DoMeleeConnectDialog (PCONNECT_DIALOG_STATE state) +{ + if (!state->Initialized) + { + state->Initialized = TRUE; + SetDefaultMenuRepeatDelay (); + /* Prepare widgets, draw stuff, etc. */ + } + + /* But this is skeletal, so just end immediately */ + return FALSE; +} + +BOOLEAN +MeleeConnectDialog (int side) +{ + CONNECT_DIALOG_STATE state; + + state.Initialized = FALSE; + state.which_side = side; + state.InputFunc = DoMeleeConnectDialog; + + DoInput ((PVOID)&state, TRUE); + + return TRUE; +} + +#endif /* NETPLAY */ diff --git a/sc2/src/sc2code/cnctdlg.h b/sc2/src/sc2code/cnctdlg.h new file mode 100644 index 000000000..5492601b5 --- /dev/null +++ b/sc2/src/sc2code/cnctdlg.h @@ -0,0 +1,31 @@ +//Copyright Michael Martin, 2006 + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef NETPLAY + +#ifndef _CNCTDLG_H +#define _CNCTDLG_H + +#include "libs/compiler.h" + +BOOLEAN MeleeConnectDialog (int side); + +#endif /* _CNCTDLG_H */ + +#endif /* NETPLAY */ + diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index 787ca1327..9d083c3e3 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -2503,9 +2503,16 @@ DoMelee (PMELEE_STATE pMS) #ifdef NETPLAY case NET_TOP: case NET_BOT: - pMS->Initialized = FALSE; - pMS->InputFunc = DoConnectingDialog; + { + COUNT which_side; + which_side = pMS->MeleeOption == NET_TOP ? 1 : 0; + if (MeleeConnectDialog (which_side)) + { + pMS->Initialized = FALSE; + pMS->InputFunc = DoConnectingDialog; + } break; + } #endif case CONTROLS_TOP: case CONTROLS_BOT: