allow arbitrary resolutions to be specified on command line (d1x r1.2, r1.29, r1.4) -- doesn't work yet
This commit is contained in:
parent
6f9c8a6216
commit
d9b238dc94
|
@ -1,5 +1,9 @@
|
|||
2004-05-19 Bradley Bell <btb@icculus.org>
|
||||
|
||||
* 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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -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 <t> %s\n","select texmapper to use (c,fp,i386,pent,ppro)");
|
||||
#ifdef __MSDOS__
|
||||
printf( " -<X>x<Y> %s\n", "Change screen resolution. Options:");
|
||||
printf( " 320x100;320x200;320x240;320x400;640x400;640x480;800x600;1024x768\n");
|
||||
#else
|
||||
printf( " -<X>x<Y> %s\n", "Change screen resolution to <X> by <Y>");
|
||||
#endif
|
||||
printf( " -automap<X>x<Y> %s\n","Set automap resolution to <X> by <Y>");
|
||||
printf( " -automap_gameres %s\n","Set automap to use the same resolution as in game");
|
||||
// printf( " -menu<X>x<Y> %s\n","Set menu resolution to <X> by <Y>");
|
||||
|
@ -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;
|
||||
int screen_flags = VRF_COMPATIBLE_MENUS;
|
||||
u_int32_t Game_screen_mode = 0; // HACK -- from d1x game.c
|
||||
|
||||
//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<argnum)) {argnum=i; screen_mode = SM( X , Y ); con_printf(CON_VERBOSE, "Using " #X "x" #Y " ...\n" );screen_width = X;screen_height = Y;use_double_buffer = 1;screen_compatible = C;}
|
||||
//aren't #defines great? :)
|
||||
if (FindResArg("", &screen_width, &screen_height))
|
||||
{
|
||||
if ((screen_width == 320 && screen_height == 200) ||
|
||||
(screen_width == 640 && screen_height == 480))
|
||||
screen_flags |= VRF_COMPATIBLE_MENUS;
|
||||
else
|
||||
screen_flags &= ~VRF_COMPATIBLE_MENUS;
|
||||
|
||||
SCREENMODE(320,100,0);
|
||||
SCREENMODE(320,200,1);
|
||||
//end addition/edit -MM
|
||||
SCREENMODE(320,240,0);
|
||||
SCREENMODE(320,400,0);
|
||||
SCREENMODE(640,400,0);
|
||||
SCREENMODE(640,480,0);
|
||||
SCREENMODE(800,600,0);
|
||||
SCREENMODE(1024,768,0);
|
||||
SCREENMODE(1152,864,0);
|
||||
SCREENMODE(1280,960,0);
|
||||
SCREENMODE(1280,1024,0);
|
||||
SCREENMODE(1600,1200,0);
|
||||
//end addition -MM
|
||||
|
||||
//added ifdefs on 9/30/98 by Matt Mueller to fix high res in linux
|
||||
#ifdef __MSDOS__
|
||||
if ( FindArg( "-nodoublebuffer" ) ) {
|
||||
con_printf(CON_VERBOSE, "Double-buffering disabled...\n" );
|
||||
#endif
|
||||
use_double_buffer = 0;
|
||||
#ifdef __MSDOS__
|
||||
con_printf(CON_VERBOSE, "Using %ix%i ...\n", screen_width, screen_height);
|
||||
}
|
||||
#endif
|
||||
//end addition -MM
|
||||
|
||||
//added 3/24/99 by Owen Evans for screen res changing
|
||||
// Game_Screen_mode = screen_mode;
|
||||
//end added -OE
|
||||
game_init_render_buffers(screen_mode, screen_width, screen_height, vr_mode, screen_compatible);
|
||||
|
||||
// added ifdef on 9/30/98 by Matt Mueller to fix high res in linux
|
||||
#ifdef __MSDOS__
|
||||
if (FindArg("-nodoublebuffer"))
|
||||
#endif
|
||||
// end addition -MM
|
||||
{
|
||||
con_printf(CON_VERBOSE, "Double-buffering disabled...\n");
|
||||
screen_flags &= ~VRF_USE_PAGING;
|
||||
}
|
||||
|
||||
// added 3/24/99 by Owen Evans for screen res changing
|
||||
Game_screen_mode = SM(screen_width, screen_height);
|
||||
// end added -OE
|
||||
game_init_render_buffers(Game_screen_mode, screen_width, screen_height, vr_mode, screen_flags);
|
||||
|
||||
}
|
||||
{
|
||||
//added/edited on 12/14/98 by Matt Mueller - override res in d1x.ini with command line args
|
||||
int i, argnum=INT_MAX;
|
||||
//added on 9/30/98 by Matt Mueller for selectable automap modes - edited 11/21/99 whee, more fun with defines.
|
||||
#define SMODE(V,VV,VG,X,Y) if ( (i=FindArg( "-" #V #X "x" #Y )) && (i<argnum)) {argnum=i; VV = SM( X , Y );VG=0;}
|
||||
// added/edited on 12/14/98 by Matt Mueller - override res in d1x.ini with command line args
|
||||
int i, argnum = INT_MAX, w, h;
|
||||
// added on 9/30/98 by Matt Mueller for selectable automap modes - edited 11/21/99 whee, more fun with defines. - edited 03/31/02 to use new FindResArg.
|
||||
#define SMODE(V,VV,VG) if ((i=FindResArg(#V, &w, &h)) && (i < argnum)) { argnum = i; VV = SM(w, h); VG = 0; }
|
||||
#define SMODE_GR(V,VG) if ((i=FindArg("-" #V "_gameres"))){if (i<argnum) VG=1;}
|
||||
#define SMODE_PRINT(V,VV,VG) if (VG) con_printf(CON_VERBOSE, #V " using game resolution ...\n"); else con_printf(CON_VERBOSE, #V " using %ix%i ...\n",SM_W(VV),SM_H(VV) );
|
||||
//aren't #defines great? :)
|
||||
//end addition/edit -MM
|
||||
#define S_MODE(V,VV,VG) argnum=INT_MAX;SMODE(V,VV,VG,320,200);SMODE(V,VV,VG,320,240);SMODE(V,VV,VG,320,400);SMODE(V,VV,VG,640,400);SMODE(V,VV,VG,640,480);SMODE(V,VV,VG,800,600);SMODE(V,VV,VG,1024,768);SMODE(V,VV,VG,1280,1024);SMODE(V,VV,VG,1600,1200);SMODE_GR(V,VG);SMODE_PRINT(V,VV,VG);
|
||||
// aren't #defines great? :)
|
||||
// end addition/edit -MM
|
||||
#define S_MODE(V,VV,VG) argnum = INT_MAX; SMODE(V, VV, VG); SMODE_GR(V, VG); SMODE_PRINT(V, VV, VG);
|
||||
|
||||
S_MODE(automap,automap_mode,automap_use_game_res);
|
||||
// S_MODE(menu,menu_screen_mode,menu_use_game_res);
|
||||
|
|
34
misc/args.c
34
misc/args.c
|
@ -1,4 +1,4 @@
|
|||
/* $Id: args.c,v 1.10 2003-11-26 12:26:33 btb Exp $ */
|
||||
/* $Id: args.c,v 1.11 2004-05-19 21:20:09 btb Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -57,7 +57,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#endif
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: args.c,v 1.10 2003-11-26 12:26:33 btb Exp $";
|
||||
static char rcsid[] = "$Id: args.c,v 1.11 2004-05-19 21:20:09 btb Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -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<Num_args; i++ )
|
||||
|
@ -81,6 +82,33 @@ int FindArg( char * s ) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int FindResArg(char *prefix, int *sw, int *sh)
|
||||
{
|
||||
int i;
|
||||
int w, h;
|
||||
char *endptr;
|
||||
int prefixlen = strlen(prefix);
|
||||
|
||||
for (i = 0; i < Num_args; ++i)
|
||||
if (Args[i][0] == '-' && !strncasecmp(Args[i] + 1, prefix, prefixlen))
|
||||
{
|
||||
w = strtol(Args[i] + 1 + prefixlen, &endptr, 10);
|
||||
if (w > 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;
|
||||
|
|
Loading…
Reference in a new issue