From d9b238dc940e5afd7454c62d3f60d59a289d6459 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Wed, 19 May 2004 21:20:09 +0000 Subject: [PATCH] allow arbitrary resolutions to be specified on command line (d1x r1.2, r1.29, r1.4) -- doesn't work yet --- ChangeLog | 4 +++ include/args.h | 46 ++++++++++---------------- main/inferno.c | 90 +++++++++++++++++++++++--------------------------- misc/args.c | 34 +++++++++++++++++-- 4 files changed, 93 insertions(+), 81 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52630b72..641925da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-05-19 Bradley Bell + * include/args.h, main/inferno.c, misc/args.c: allow arbitrary + resolutions to be specified on command line (d1x r1.2, r1.29, + r1.4) -- doesn't work yet + * arch/linux/hmiplay.c: needs to include args.h now (d1x r1.9) * arch/linux/hmiplay.c: implement -nomusic for linux hmiplay (d1x diff --git a/include/args.h b/include/args.h index c0ac8f29..d58258d5 100644 --- a/include/args.h +++ b/include/args.h @@ -1,3 +1,4 @@ +/* $Id: args.h,v 1.5 2004-05-19 21:20:06 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,59 +8,46 @@ IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvs/cvsroot/d2x/include/args.h,v $ - * $Revision: 1.4 $ - * $Author: bradleyb $ - * $Date: 2001-11-05 07:39:08 $ - * - * Prototypes for accessing arguments. - * - * $Log: not supported by cvs2svn $ - * Revision 1.3 2001/10/19 00:31:51 bradleyb - * Trying to get network working on win32 - * - * Revision 1.2 2001/01/24 04:29:45 bradleyb - * changed args_find to FindArg * - * Revision 1.1.1.1 2001/01/19 03:30:16 bradleyb - * Import of d2x-0.0.8 + * Prototypes for accessing arguments. * - * Revision 1.1.1.1 1999/06/14 22:02:08 donut - * Import of d1x 1.37 source. + * Old Log: + * Revision 1.1 1995/05/16 15:54:24 allender + * Initial revision * * Revision 2.0 1995/02/27 11:33:09 john * New version 2.0, which has no anonymous unions, builds with * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. - * + * * Revision 1.4 1994/07/11 16:27:28 matt * Took out prototypes for netipx funcs - * + * * Revision 1.3 1994/05/11 19:45:34 john * *** empty log message *** - * + * * Revision 1.2 1994/05/09 17:02:55 john * Split command line parameters into arg.c and arg.h. * Also added /dma, /port, /irq to digi.c - * + * * Revision 1.1 1994/05/09 16:47:49 john * Initial revision - * - * + * + * */ - #ifndef _ARGS_H #define _ARGS_H -extern int Num_args; -extern char * Args[]; -extern int FindArg( char * s ); -extern void InitArgs( int argc, char **argv ); +extern int Num_args; +extern char *Args[]; +extern int FindArg(char *s); +extern int FindResArg(char *prefix, int *sw, int *sh); +extern void InitArgs(int argc, char **argv); extern int Inferno_verbose; #endif diff --git a/main/inferno.c b/main/inferno.c index 83c5d5a8..79cdd078 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -1,4 +1,4 @@ -/* $Id: inferno.c,v 1.71 2004-04-15 07:34:28 btb Exp $ */ +/* $Id: inferno.c,v 1.72 2004-05-19 21:20:07 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -1006,6 +1006,12 @@ void print_commandline_help() printf( " -xname %s\n","FIXME: Undocumented"); printf( " -xver %s\n","FIXME: Undocumented"); printf( " -tmap %s\n","select texmapper to use (c,fp,i386,pent,ppro)"); +#ifdef __MSDOS__ + printf( " -x %s\n", "Change screen resolution. Options:"); + printf( " 320x100;320x200;320x240;320x400;640x400;640x480;800x600;1024x768\n"); +#else + printf( " -x %s\n", "Change screen resolution to by "); +#endif printf( " -automapx %s\n","Set automap resolution to by "); printf( " -automap_gameres %s\n","Set automap to use the same resolution as in game"); // printf( " -menux %s\n","Set menu resolution to by "); @@ -1143,9 +1149,6 @@ int main(int argc, char *argv[]) { int i, t; ubyte title_pal[768]; - int screen_width = 640; - int screen_height = 480; - u_int32_t screen_mode = SM(screen_width,screen_height); con_init(); // Initialise the console mem_init(); @@ -1297,60 +1300,49 @@ int main(int argc, char *argv[]) #endif { -//added on 12/14/98 by Matt Mueller - override res in d1x.ini with command line args - int i, argnum=INT_MAX; -//end addition -MM + int screen_width = 640; + int screen_height = 480; int vr_mode = VR_NONE; - int screen_compatible = 1; - int use_double_buffer = 0; - -//added/edited on 12/14/98 by Matt Mueller - override res in d1x.ini with command line args -//added on 9/30/98 by Matt Mueller clean up screen mode code, and add higher resolutions -#define SCREENMODE(X,Y,C) if ( (i=FindArg( "-" #X "x" #Y ))&&(i @@ -71,7 +71,8 @@ static char rcsid[] = "$Id: args.c,v 1.10 2003-11-26 12:26:33 btb Exp $"; int Num_args=0; char * Args[100]; -int FindArg( char * s ) { +int FindArg(char *s) +{ int i; for (i=0; i 0 && endptr && endptr[0] == 'x') + { + h = strtol(endptr + 1, &endptr, 10); + if (h > 0 && endptr[0] == '\0') + { + *sw = w; + *sh = h; + return i; + } + } + } + + return 0; + +} + void args_exit(void) { int i; -- 2.39.2