[conquest] full screen
Jon Trulson
jon at radscan.com
Tue Dec 27 14:34:58 MST 2005
On Tue, 27 Dec 2005, Jon Trulson wrote:
> On Tue, 27 Dec 2005, Bill Patterson wrote:
>
>> Ooops. Full screen hack doesn't work with the server browser...
>>
>
> Interesting... seems to fail with playback (of .cqr's) too. '-f' is
> working fine, but -geometry seems to get confused. I'll investigate.
>
Ok... there seemed to be some confusion with the args and gluts
parsing of them. So I removed the -geometry hack and and just implemented
a '-g WxH' option. This seems to work at all times :)
Please try the attached patch (using -g instead of -geometry) and
see if that works. This patch also incorporates the conquestd futex wait
hang workaround.
You should apply this to virgin 8.1.1 srcs. There is also a patch
that removes some ancient (but mostly harmless) cruft I stumbled upon in
conquest.h - we aren't trying to use X11/Xt/Motif for the GUI anymore :)
--
Jon Trulson mailto:jon at radscan.com
ID: 1A9A2B09, FP: C23F328A721264E7 B6188192EC733962
PGP keys at http://radscan.com/~jon/PGPKeys.txt
#include <std/disclaimer.h>
"I am Nomad." -Nomad
-------------- next part --------------
Index: conquestgl.c
===================================================================
RCS file: /home/jon/src/repository/conquest/conquestgl.c,v
retrieving revision 1.9
retrieving revision 1.11
diff -u -r1.9 -r1.11
--- conquestgl.c 14 Nov 2004 22:34:04 -0000 1.9
+++ conquestgl.c 27 Dec 2005 21:10:41 -0000 1.11
@@ -2,7 +2,7 @@
/************************************************************************
*
- * $Id: conquestgl.c,v 1.9 2004/11/14 22:34:04 jon Exp $
+ * $Id: conquestgl.c,v 1.11 2005/12/27 21:10:41 jon Exp $
*
* Copyright 1999-2004 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
***********************************************************************/
@@ -53,7 +53,12 @@
void printUsage()
{
printf("Usage: conquestgl [-m ][-s server[:port]] [-r recfile] [ -t ]\n");
- printf(" [ -M <metaserver> ] [ -u ]\n\n");
+ printf(" [-f ][-g <geometry>] [ -u ]\n");
+ printf(" [ -M <metaserver> ]\n\n");
+ printf(" -f run in fullscreen mode\n");
+ printf(" -g <geometry> specify intial window width/height.\n");
+ printf(" Format is WxH (ex: 1024x768).\n");
+ printf(" Default is 800x600.\n");
printf(" -m query the metaserver\n");
printf(" -s server[:port] connect to <server> at <port>\n");
printf(" default: localhost:1701\n");
@@ -90,6 +95,44 @@
return TRUE;
}
+/* parse the geometry arg. Ensure that dConf init w/h are only
+ * set if the geom arg was reasonably valid. Format WxH (ex: 1024x768)
+ */
+static void parseGeometry(char *geom)
+{
+ char geomcpy[32];
+ char *ch;
+ int w, h;
+
+ if (!geom || !*geom)
+ return;
+
+ memset((void *)geomcpy, 0, 32);
+ strncpy(geomcpy, geom, 32 - 1);
+
+ if ((ch = strchr(geomcpy, 'x')) == NULL)
+ return; /* invalid */
+
+ *ch = 0;
+ ch++;
+
+ if (!*ch)
+ return;
+
+ w = abs(atoi(geomcpy));
+ h = abs(atoi(ch));
+
+ if (!w || !h)
+ return;
+
+ /* set it up */
+ dConf.initWidth = w;
+ dConf.initHeight = h;
+
+ return;
+}
+
+
/* conquest - main program */
int main(int argc, char *argv[])
{
@@ -121,10 +164,18 @@
cInfo.remotehost = strdup("localhost"); /* default to your own server */
+ dspInitData();
+
/* check options */
- while ((i = getopt(argc, argv, "mM:s:r:tP:d:u")) != EOF) /* get command args */
+ while ((i = getopt(argc, argv, "fmM:s:r:tP:d:ug:")) != EOF) /* get command args */
switch (i)
{
+ case 'f':
+ dConf.fullScreen = TRUE;
+ break;
+ case 'g': /* to let '-geometry' slide by *HACK* */
+ parseGeometry(optarg);
+ break;
case 'm':
wantMetaList = TRUE;
break;
Index: gldisplay.h
===================================================================
RCS file: /home/jon/src/repository/conquest/gldisplay.h,v
retrieving revision 1.7
retrieving revision 1.9
diff -u -r1.7 -r1.9
--- gldisplay.h 30 May 2005 08:22:47 -0000 1.7
+++ gldisplay.h 27 Dec 2005 21:10:42 -0000 1.9
@@ -1,6 +1,6 @@
/************************************************************************
*
- * $Id: gldisplay.h,v 1.7 2005/05/30 08:22:47 jon Exp $
+ * $Id: gldisplay.h,v 1.9 2005/12/27 21:10:42 jon Exp $
*
* Copyright 2003 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
***********************************************************************/
@@ -37,6 +37,8 @@
unsigned int flags;
+ int fullScreen;
+ int initWidth, initHeight; /* initial wxh geometry */
} dspConfig_t;
#ifdef NOEXTERN_DCONF
@@ -235,5 +237,6 @@
void drawQuad(GLfloat x, GLfloat y, GLfloat w, GLfloat h, GLfloat z);
void drawExplosion(GLfloat x, GLfloat y, int snum, int torpnum);
+void dspInitData(void);
#endif /* _GLDISPLAY_H */
Index: GL.c
===================================================================
RCS file: /home/jon/src/repository/conquest/GL.c,v
retrieving revision 1.23
retrieving revision 1.25
diff -u -r1.23 -r1.25
--- GL.c 10 Aug 2005 15:51:37 -0000 1.23
+++ GL.c 27 Dec 2005 21:10:41 -0000 1.25
@@ -2,7 +2,7 @@
*
* Jon Trulson, 1/2003
*
- * $Id: GL.c,v 1.23 2005/08/10 15:51:37 jon Exp $
+ * $Id: GL.c,v 1.25 2005/12/27 21:10:41 jon Exp $
*
* Copyright 2003 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
*/
@@ -37,7 +37,6 @@
#include "glmisc.h"
#include "glfont.h"
-#define NOEXTERN
#include "conquest.h"
/* torp animation state */
@@ -918,13 +917,16 @@
}
-static void dspInitData(void)
+void dspInitData(void)
{
memset((void *)&dConf, 0, sizeof(dspConfig_t));
+ dConf.inited = False;
+
+ dConf.fullScreen = FALSE;
+ dConf.initWidth = 800;
+ dConf.initHeight = 600;
dConf.wX = dConf.wY = 0;
- dConf.wW = 800;
- dConf.wH = 600;
memset((void *)&dData, 0, sizeof(dspData_t));
@@ -956,20 +958,19 @@
#ifdef DEBUG_GL
clog("uiGLInit: ENTER");
#endif
- memset(&ConqData, 0, sizeof(ConqData));
-
- dConf.inited = False;
-
- dspInitData();
glutInit(argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA);
glutInitWindowPosition(0,0);
- glutInitWindowSize(dConf.wW, dConf.wH);
+
+ glutInitWindowSize(dConf.initWidth, dConf.initHeight);
dConf.mainw = glutCreateWindow(CONQUESTGL_NAME);
+ if(dConf.fullScreen)
+ glutFullScreen();
+
glutKeyboardFunc (charInput);
glutSpecialFunc (input);
glutMouseFunc (mouse);
Index: conquest.h
===================================================================
RCS file: /home/jon/src/repository/conquest/conquest.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- conquest.h 2 Nov 2003 20:53:00 -0000 1.2
+++ conquest.h 27 Dec 2005 21:10:41 -0000 1.3
@@ -1,7 +1,7 @@
/************************************************************************
*
- * $Id: conquest.h,v 1.2 2003/11/02 20:53:00 jon Exp $
+ * $Id: conquest.h,v 1.3 2005/12/27 21:10:41 jon Exp $
*
* Copyright 2003 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
***********************************************************************/
@@ -9,49 +9,6 @@
#ifndef CONQUEST_H
#define CONQUEST_H
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Intrinsic.h>
-
-#ifdef NOEXTERN
-#define C2EXTERN
-#else
-#define C2EXTERN extern
-#endif
-
#define CONQUESTGL_NAME "ConquestGL"
-typedef struct _ConquestDataRec *ConquestDataPtr;
-
-typedef struct _ConquestDataRec {
- Display *dpy;
- XtAppContext app;
- XtIntervalId timerId;
- XtWorkProcId workId;
-
- Bool rendering; /* are we rendering? */
-
- Widget toplevel;
-
- /* some colors */
- Pixel whitePixel;
- Pixel blackPixel;
- Pixel redPixel;
- Pixel yellowPixel;
- Pixel greenPixel;
- Pixel bluePixel;
- Pixel cyanPixel;
- Pixel magentaPixel;
-
- Pixel defaultPixel;
- Pixel infoPixel;
- Pixel specialPixel;
- Pixel statsepPixel;
-
-} ConquestDataRec;
-
-
-C2EXTERN ConquestDataRec ConqData;
-
-#undef C2EXTERN
#endif
Index: conquestd.c
===================================================================
RCS file: /home/jon/src/repository/conquest/conquestd.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- conquestd.c 4 Jul 2005 03:18:22 -0000 1.26
+++ conquestd.c 25 Dec 2005 20:24:00 -0000 1.27
@@ -4,7 +4,7 @@
*
* conquestd - the Conquest server/client driver
*
- * $Id: conquestd.c,v 1.26 2005/07/04 03:18:22 jon Exp $
+ * $Id: conquestd.c,v 1.27 2005/12/25 20:24:00 jon Exp $
*
* Copyright 2003 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
***********************************************************************/
@@ -499,8 +499,6 @@
stopUpdate();
- drcheck(); /* check the driver */
-
/* update client view of the universe */
updateClient(FALSE);
@@ -1635,6 +1633,11 @@
laststat = now;
}
+ clbBlockAlarm(); /* no signals can be accepted when
+ drcheck is run */
+ drcheck();
+ clbUnblockAlarm();
+
if (didsomething)
continue; /* see if there is another pkt */
Index: HISTORY
===================================================================
RCS file: /home/jon/src/repository/conquest/HISTORY,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- HISTORY 10 Aug 2005 15:51:38 -0000 1.41
+++ HISTORY 25 Dec 2005 20:23:59 -0000 1.42
@@ -9,6 +9,17 @@
Conquest HISTORY
+???
+
+ - add patch by Bill Patterson adding a '-f' fullscreen option
+ to conquestgl.
+
+ - fixed localtime() libc futex wait hang in conquestd by
+ moving drcheck() out of the signal handler. Bad Juju.
+ Thanks to Bill Patterson for letting me have access to his
+ server to locate the problem and test a fix.
+
+
Version 8.1.1 (stable)
- during playback of a recording, honor the user config
More information about the Conquest
mailing list