Cleaned up more FindArg's - general Debug Options; Cleanups

This commit is contained in:
zicodxx 2007-07-18 20:13:17 +00:00
parent 977084d457
commit 8e2aa8ea2a
16 changed files with 110 additions and 145 deletions

View file

@ -61,8 +61,6 @@ ubyte gr_palette_gamma = 0;
int gr_palette_gamma_param = 0;
ubyte gr_palette_faded_out = 1;
int grd_fades_disabled=0; // Used to skip fading for development
void gr_palette_set_gamma( int gamma )
{
if ( gamma < 0 ) gamma = 0;

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20070718
--------
SCsonstruct, 2d/palette.c, arch/ogl/gr.c, arch/ogl/ogl.c, arch/sdl/gr.c, include/args.h, include/gr.h, include/ogl_init.h, include/palette.h, main/game.c, main/inferno.c, main/movie.c, main/render.c, main/text.c, misc/args.c: Cleaned up more FindArg's - general Debug Options; Cleanups
20070716
--------
d2x.ini, arch/ogl/gr.c, arch/ogl/ogl.c, arch/ogl/include/internal.h, arch/sdl/gr.c, include/args.h, include/gr.h, include/ogl_init.h, main/automap.c, main/game.c, main/game.h, main/gamecntl.c, main/gamefont.c, main/gauges.c, main/inferno.c, main/menu.c, main/movie.c, main/newmenu.c, main/titles.c, misc/args.c: Cleaned up more FindArg's - (most important) OpenGL Options

View file

@ -344,7 +344,7 @@ if sys.platform == 'win32':
sharepath = ''
env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL', 'NATIVE_IPX'])
env.Append(CPPPATH = ['arch/win32/include', '/msys/1.0/MinGW/include/SDL'])
ogldefines = ['SDL_GL_VIDEO', 'OGL', 'OGL_RUNTIME_LOAD']
ogldefines = ['SDL_GL_VIDEO', 'OGL']
common_sources += arch_win32_sources
ogllibs = ''
winlibs = ['glu32', 'wsock32', 'winmm', 'mingw32', 'SDLmain']

View file

@ -280,26 +280,14 @@ int ogl_testneedmipmaps(int i){
Error("unknown texture filter %x\n",i);
}
#ifdef OGL_RUNTIME_LOAD
#ifdef _WIN32
char *OglLibPath="opengl32.dll";
#endif
#ifdef __unix__
char *OglLibPath="libGL.so";
#endif
#ifdef macintosh
char *OglLibPath = NULL;
#endif
int ogl_rt_loaded=0;
int ogl_init_load_library(void)
{
int retcode=0;
if (!ogl_rt_loaded){
int t;
if ((t=FindArg("-gl_library")))
OglLibPath=Args[t+1];
retcode = OpenGL_LoadLibrary(true);
if(retcode)
{
@ -320,31 +308,19 @@ int ogl_init_load_library(void)
int gr_init(int mode)
{
int retcode, t, glt = 0;
int retcode, t;
// Only do this function once!
if (gr_installed==1)
return -1;
#ifdef OGL_RUNTIME_LOAD
#ifdef _WIN32
ogl_init_load_library();
#endif
if (!GameArg.SysWindow)
gr_toggle_fullscreen();
if ((glt=FindArg("-gl_alttexmerge")))
ogl_alttexmerge=1;
if ((t=FindArg("-gl_stdtexmerge")))
if (t>=glt)//allow overriding of earlier args
ogl_alttexmerge=0;
if ((glt = FindArg("-gl_16bittextures")))
{
ogl_rgba_internalformat = GL_RGB5_A1;
ogl_rgb_internalformat = GL_RGB5;
}
GL_needmipmaps=ogl_testneedmipmaps(GameArg.OglTexMinFilt);
if ((t = FindArg("-gl_anisotropy")) || (t = FindArg("-gl_anisotropic")))
@ -401,7 +377,7 @@ void gr_close()
d_free(grd_curscreen);
}
ogl_close_pixel_buffers();
#ifdef OGL_RUNTIME_LOAD
#ifdef _WIN32
if (ogl_rt_loaded)
OpenGL_LoadLibrary(false);
#endif

View file

@ -79,7 +79,6 @@ int GL_TEXTURE_2D_enabled=-1;
int GL_texclamp_enabled=-1;
int r_texcount = 0, r_cachedtexcount = 0;
int ogl_alttexmerge=1;//merge textures by just printing the seperate textures?
int ogl_rgba_internalformat = GL_RGBA8;
int ogl_rgb_internalformat = GL_RGB8;
int ogl_intensity4_ok=1;
@ -246,7 +245,7 @@ int ogl_texture_stats(void){
usedother++;
}
}
if (gr_renderstats)
if (GameArg.DbgRenderStats)
{
GLint idx, r, g, b, a, dbl, depth;
int res, colorsize, depthsize;
@ -279,7 +278,7 @@ void ogl_clean_texture_cache(void){
int time=120;
if (ogl_mem_target<0){
if (gr_renderstats)
if (GameArg.DbgRenderStats)
ogl_texture_stats();
return;
}
@ -416,7 +415,7 @@ void ogl_cache_level_textures(void)
if (tmap2 != 0){
PIGGY_PAGE_IN(Textures[tmap2&0x3FFF]);
bm2 = &GameBitmaps[Textures[tmap2&0x3FFF].index];
if (ogl_alttexmerge == 0 || (bm2->bm_flags & BM_FLAG_SUPER_TRANSPARENT))
if (GameArg.DbgAltTexMerge == 0 || (bm2->bm_flags & BM_FLAG_SUPER_TRANSPARENT))
bm = texmerge_get_cached_bitmap( tmap1, tmap2 );
else {
ogl_loadbmtexture(bm2);
@ -1015,9 +1014,8 @@ void ogl_end_frame(void){
void gr_flip(void)
{
ogl_clean_texture_cache();
if (gr_renderstats){
if (GameArg.DbgRenderStats)
gr_printf(5,GAME_FONT->ft_h*13+3*13,"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc);
}
ogl_do_palfx();
ogl_swap_buffers_internal();

View file

@ -425,13 +425,6 @@ int gr_palette_fade_out(ubyte *pal, int nsteps, int allow_keys)
if (gr_palette_faded_out) return 0;
#if 1 //ifndef NDEBUG
if (grd_fades_disabled) {
gr_palette_clear();
return 0;
}
#endif
palette = screen->format->palette;
if (palette == NULL) {
return -1; // Display is not palettised
@ -492,13 +485,6 @@ int gr_palette_fade_in(ubyte *pal, int nsteps, int allow_keys)
if (!gr_palette_faded_out) return 0;
#if 1 //ifndef NDEBUG
if (grd_fades_disabled) {
gr_palette_load(pal);
return 0;
}
#endif
palette = screen->format->palette;
if (palette == NULL) {

View file

@ -41,6 +41,7 @@ extern int Inferno_verbose;
// Dbg - Debugging/Undocumented Options
typedef struct Arg
{
int SysShowCmdHelp;
int SysFPSIndicator;
int SysUseNiceFPS;
int SysMaxFPS;
@ -85,7 +86,18 @@ typedef struct Arg
char *MplIpMyAddr;
int MplIpBasePort;
#ifdef EDITOR
char *EdiAutoLoad;
int EdiMacData;
int EdiSaveHoardData;
#endif
int DbgVerbose;
int DbgNoRun;
int DbgRenderStats;
char *DbgAltTex;
char *DbgTexMap;
int DbgNoMovies;
#ifdef OGL
int DbgAltTexMerge;
#endif
} __attribute__ ((packed)) Arg;

View file

@ -397,8 +397,6 @@ extern unsigned char Test_bitmap_data[64*64];
//shortcut to look at current font
#define grd_curfont grd_curcanv->cv_font
extern int gr_renderstats;
extern unsigned int FixDivide( unsigned int x, unsigned int y );
extern void gr_set_current_canvas( grs_canvas *canv );

View file

@ -13,16 +13,11 @@
# define MAC(x)
#endif
#ifdef _MSC_VER //_WIN32
#define OGL_RUNTIME_LOAD
#endif
#ifdef OGL_RUNTIME_LOAD
#ifdef _WIN32
#include "loadgl.h"
int ogl_init_load_library(void);
#else
#define GL_GLEXT_LEGACY
#undef GL_ARB_multitexture
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
@ -62,7 +57,6 @@ typedef struct _ogl_texture {
extern ogl_texture* ogl_get_free_texture();
void ogl_init_texture(ogl_texture* t, int w, int h, int flags);
extern int ogl_alttexmerge;//merge textures by just printing the seperate textures?
extern int ogl_rgba_internalformat;
extern int ogl_rgb_internalformat;
extern int ogl_setgammaramp_ok;

View file

@ -26,7 +26,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
extern void gr_palette_set_gamma( int gamma );
extern int gr_palette_get_gamma();
extern ubyte gr_palette_faded_out;
extern int grd_fades_disabled;
extern void gr_palette_clear();
extern int gr_palette_fade_out(ubyte *pal, int nsteps, int allow_keys );
extern int gr_palette_fade_in(ubyte *pal,int nsteps, int allow_keys );

View file

@ -1528,9 +1528,6 @@ int Config_menu_flag;
jmp_buf LeaveGame;
int gr_renderstats = 0;
// need to define "cheat" for renderstats
int Cheats_enabled=0;
extern int Laser_rapid_fire;

View file

@ -224,48 +224,32 @@ void print_commandline_help()
printf( " -ip_baseport <n> %s\n", "Use <p> as offset from normal port (allows multiple instances of d1x to be run on a single computer)");
#endif // NETWORK
#ifndef NDEBUG
printf( "\n Debug:\n\n");
printf( " -debug %s\n", "Enable very verbose output");
printf( " -Verbose %s\n", "Shows initialization steps for tech support");
printf( " -renderstats %s\n", "Enable renderstats info by default");
printf( " -norun %s\n", "Bail out after initialization");
printf( " -nofade %s\n", "Disable fades");
printf( " -norun %s\n", "Bail out after initialization");
printf( " -text <file> %s\n", "Specify alternate .tex file");
#ifndef RELEASE
printf( " -nomovies %s\n", "Don't play movies");
#endif // RELEASE
#ifdef SDL_VIDEO
printf( " -nosdlvidmodecheck %s\n", "Some X servers don't like checking vidmode first, so just switch");
#endif // SDL_VIDEO
#ifdef EDITOR
printf( "\n Editor:\n\n");
printf( " -autoload <file> %s\n", "Autoload a level in the editor");
printf( " -autoload <s> %s\n", "Autoload a level in the editor");
printf( " -macdata %s\n", "Read and write mac data files in editor (swap colors)");
printf( " -hoarddata %s\n", "Make the hoard ham file from some files, then exit");
#endif // EDITOR
#ifndef NDEBUG
printf( "\n Debug:\n\n");
printf( " -debug %s\n", "Enable very verbose output");
printf( " -verbose %s\n", "Shows initialization steps for tech support");
printf( " -norun %s\n", "Bail out after initialization");
printf( " -renderstats %s\n", "Enable renderstats info by default");
printf( " -text <s> %s\n", "Specify alternate .tex file");
printf( " -tmap <s> %s\n", "Select texmapper to use (c,fp,quad,i386,pent,ppro)");
printf( " -nomovies %s\n", "Don't play movies");
#ifdef OGL
printf( " -gl_oldtexmerge %s\n", "Use old texmerge, uses more ram, but _might_ be a bit faster");
#endif
/* KEPT FOR FURTHER REFERENCE
printf( "\n Unused / Obsolete:\n\n");
printf( " -nobm %s\n", "FIXME: Undocumented");
printf( " -bigpig %s\n", "FIXME: Undocumented");
printf( " -bspgen %s\n", "FIXME: Undocumented");
printf( " -cdproxy %s\n", "FIXME: Undocumented");
printf( " -checktime %s\n", "FIXME: Undocumented");
printf( " -showmeminfo %s\n", "FIXME: Undocumented");
printf( " -codereadonly %s\n", "FIXME: Undocumented");
printf( " -cyberimpact %s\n", "FIXME: Undocumented");
printf( " -debugmode %s\n", "FIXME: Undocumented");
printf( " -disallowgfx %s\n", "FIXME: Undocumented");
printf( " -disallowreboot %s\n", "FIXME: Undocumented");
printf( " -dynamicsockets %s\n", "FIXME: Undocumented");
printf( " -forcegfx %s\n", "FIXME: Undocumented");
printf( " -hw_3dacc %s\n", "FIXME: Undocumented");
printf( " -jasen %s\n", "FIXME: Undocumented");
printf( " -joyslow %s\n", "FIXME: Undocumented");
printf( " -logfile %s\n", "FIXME: Undocumented");
printf( " -memdbg %s\n", "FIXME: Undocumented");
printf( " -monodebug %s\n", "FIXME: Undocumented");
printf( " -nocyberman %s\n", "FIXME: Undocumented");
@ -273,7 +257,6 @@ void print_commandline_help()
printf( " -showaddress %s\n", "FIXME: Undocumented");
printf( " -socket %s\n", "FIXME: Undocumented");
printf( " -nomodex %s\n", "FIXME: Undocumented");
printf( " -ordinaljoy %s\n", "FIXME: Undocumented");
printf( " -specialdevice %s\n", "FIXME: Undocumented");
printf( " -stickmag %s\n", "FIXME: Undocumented");
printf( " -stopwatch %s\n", "FIXME: Undocumented");
@ -293,14 +276,7 @@ void print_commandline_help()
printf( " -gl_vidmem %s\n", "FIXME: Undocumented");
printf( " -hwsurface %s\n", "FIXME: Undocumented");
printf( " -gl_library <l> %s\n", "use alternate opengl library");
printf( " -emul %s\n", "Certain video cards need this option in order to run game");
printf( " -ddemul %s\n", "If -emul doesn't work, use this option");
printf( " -rtscts %s\n", "Same as -ctsrts");
printf( " -semiwin %s\n", "Use non-fullscreen mode");
printf( " -ihaveabrokenmouse %s\n", "try to make mouse work if it is not currently");
printf( " -joy209 %s\n", "Use alternate port 209 for joystick");
printf( " -serialdevice <s> %s\n", "Set serial/modem device to <s>");
printf( " -serialread <r> %s\n", "Set serial/modem to read from <r>");
*/
#endif // NDEBUG
@ -353,7 +329,6 @@ int menu_use_game_res=1;
//extern ubyte gr_current_pal[];
#ifdef EDITOR
int Auto_exit = 0;
char Auto_file[128] = "";
#endif
@ -368,10 +343,7 @@ int main(int argc, char *argv[])
error_init(NULL, NULL);
PHYSFSX_init(argc, argv);
if (FindArg("-debug"))
con_threshold.value = (float)2;
else if (FindArg("-verbose"))
con_threshold.value = (float)1;
con_threshold.value = (float)GameArg.DbgVerbose;
if (! cfile_init("descent2.hog", 1))
if (! cfile_init("d2demo.hog", 1))
@ -402,13 +374,10 @@ int main(int argc, char *argv[])
con_printf(CON_NORMAL, " Copyright (c) 2005 Christian Beckhaeuser\n");
if (FindArg( "-help" ) || FindArg( "-h" ) || FindArg( "-?" ) || FindArg( "?" ) ) {
if (GameArg.SysShowCmdHelp) {
print_commandline_help();
set_exit_message("");
#ifdef __MINGW32__
exit(0); /* mingw hangs on this return. dunno why */
#endif
return(0);
}
@ -451,20 +420,12 @@ int main(int argc, char *argv[])
atexit(sdl_close);
//con_printf(CON_VERBOSE, "\n%s...", "Checking for Descent 2 CD-ROM");
if (FindArg("-renderstats"))
gr_renderstats = 1;
#ifndef NDEBUG
if ( FindArg( "-checktime") )
checktime = 1;
#endif
if ((t=FindArg("-tmap"))){
select_tmap(Args[t+1]);
}else
select_tmap(NULL);
select_tmap(GameArg.DbgTexMap);
Lighting_on = 1;
@ -518,8 +479,6 @@ int main(int argc, char *argv[])
}
con_printf(CON_VERBOSE, "\n%s\n\n", TXT_INITIALIZING_GRAPHICS);
if (FindArg("-nofade"))
grd_fades_disabled=1;
//determine whether we're using high-res menus & movies
if (FindArg("-nohires") || FindArg("-nohighres") || (gr_check_mode(MENU_HIRES_MODE) != 0) || disable_high_res)
@ -560,7 +519,7 @@ int main(int argc, char *argv[])
bm_init();
#ifdef EDITOR
if (FindArg("-hoarddata") != 0) {
if (GameArg.EdiSaveHoardData) {
save_hoard_data();
exit(1);
}
@ -569,7 +528,7 @@ int main(int argc, char *argv[])
//the bitmap loading code changes gr_palette, so restore it
memcpy(gr_palette,title_pal,sizeof(gr_palette));
if ( FindArg( "-norun" ) )
if (GameArg.DbgNoRun)
return(0);
con_printf( CON_DEBUG, "\nInitializing 3d system..." );
@ -586,15 +545,9 @@ int main(int argc, char *argv[])
// If built with editor, option to auto-load a level and quit game
// to write certain data.
#ifdef EDITOR
{ int t;
if ( (t = FindArg( "-autoload" )) ) {
Auto_exit = 1;
strcpy(Auto_file, Args[t+1]);
}
}
if (Auto_exit) {
{
if (GameArg.EdiAutoLoad) {
strcpy(Auto_file, GameArg.EdiAutoLoad);
strcpy(Players[0].callsign, "dummy");
} else
#endif
@ -643,7 +596,7 @@ int main(int argc, char *argv[])
case FMODE_MENU:
set_screen_mode(SCREEN_MENU);
#ifdef EDITOR
if (Auto_exit) {
if (GameArg.EdiAutoLoad) {
strcpy((char *)&Level_names[0], Auto_file);
LoadLevel(1, 1);
Function_mode = FMODE_EXIT;

View file

@ -135,7 +135,7 @@ int PlayMovie(const char *filename, int must_have)
char name[FILENAME_LEN],*p;
int c, ret;
if (FindArg("-nomovies"))
if (GameArg.DbgNoMovies)
return MOVIE_NOT_PLAYED;
strcpy(name,filename);
@ -404,7 +404,7 @@ void DeInitRobotMovie(void)
int InitRobotMovie(char *filename)
{
if (FindArg("-nomovies"))
if (GameArg.DbgNoMovies)
return 0;
con_printf(CON_DEBUG, "RoboFile=%s\n", filename);
@ -610,7 +610,7 @@ void init_movies()
{
int i;
if (FindArg("-nomovies"))
if (GameArg.DbgNoMovies)
return;
for (i=0;i<N_BUILTIN_MOVIE_LIBS;i++) {
@ -639,7 +639,7 @@ void close_extra_robot_movie(void)
void init_extra_robot_movie(char *movielib)
{
if (FindArg("-nomovies"))
if (GameArg.DbgNoMovies)
return;
close_extra_robot_movie();

View file

@ -340,7 +340,7 @@ void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap
}
#ifdef OGL
if (ogl_alttexmerge){
if (GameArg.DbgAltTexMerge){
PIGGY_PAGE_IN(Textures[tmap1]);
bm = &GameBitmaps[Textures[tmap1].index];
if (tmap2){

View file

@ -105,8 +105,8 @@ void load_text()
char *tptr;
char *filename="descent.tex";
if ((i=FindArg("-text"))!=0)
filename = Args[i+1];
if (GameArg.DbgAltTex)
filename = GameArg.DbgAltTex;
if ((tfile = cfopen(filename,"rb")) == NULL) {
filename="descent.txb";

View file

@ -125,6 +125,11 @@ void ReadCmdArgs(void)
// System Options
if (FindArg( "-help" ) || FindArg( "-h" ) || FindArg( "-?" ) || FindArg( "?" ))
GameArg.SysShowCmdHelp = 1;
else
GameArg.SysShowCmdHelp = 0;
if (FindArg("-fps"))
GameArg.SysFPSIndicator = 1;
else
@ -293,16 +298,12 @@ void ReadCmdArgs(void)
GameArg.OglAlphaEffects = 0;
if ((t=FindArg("-gl_reticle")))
{
GameArg.OglReticle = atoi(Args[t+1]);
}
else
GameArg.OglReticle = 0;
if ((t=FindArg("-gl_scissor_ok")))
{
GameArg.OglScissorOk = atoi(Args[t+1]);
}
else
GameArg.OglScissorOk = 1;
@ -362,11 +363,60 @@ void ReadCmdArgs(void)
#ifdef EDITOR
// Editor Options
if ((t=FindArg( "-autoload" )))
GameArg.EdiAutoLoad = Args[t+1];
else
GameArg.EdiAutoLoad = NULL;
if (FindArg("-macdata"))
GameArg.EdiMacData = 1;
else
GameArg.EdiMacData = 0;
if (FindArg("-hoarddata"))
GameArg.EdiSaveHoardData = 1;
else
GameArg.EdiSaveHoardData = 0;
#endif
// Debug Options
if (FindArg("-debug"))
GameArg.DbgVerbose = 2;
else if (FindArg("-verbose"))
GameArg.DbgVerbose = 1;
else
GameArg.DbgVerbose = 0;
if (FindArg("-norun"))
GameArg.DbgNoRun = 1;
else
GameArg.DbgNoRun = 0;
if (FindArg("-renderstats"))
GameArg.DbgRenderStats = 1;
else
GameArg.DbgRenderStats = 0;
if ((t=FindArg("-text")))
GameArg.DbgAltTex = Args[t+1];
else
GameArg.DbgAltTex = NULL;
if ((t=FindArg("-tmap")))
GameArg.DbgTexMap = Args[t+1];
else
GameArg.DbgTexMap = NULL;
if (FindArg("-nomovies"))
GameArg.DbgNoMovies = 1;
else
GameArg.DbgNoMovies = 0;
if (FindArg("-gl_oldtexmerge"))
GameArg.DbgAltTexMerge = 0;
else
GameArg.DbgAltTexMerge = 1;
}
void args_exit(void)