Placing FindArg calls to seperated function, putting variables to a struct - frist step, not finished, yet; Large code cleanup

This commit is contained in:
zicodxx 2007-07-14 20:33:42 +00:00
parent 78103fddce
commit 38cde9ec87
29 changed files with 316 additions and 1155 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20070714
--------
SConstruct, main/game.c, main/inferno.c: removed old CD-Play code
SConstruct, d1x.ini, arch/sdl/init.c, arch/sdl/joy.c, main/args.c, main/args.h, main/config.c, main/game.c, main/game.h, main/gauges.c, main/hud.c, main/inferno.c, main/kconfig.c, main/kmatrix.c, main/laser.c, main/menu.c, main/multi.c, main/newdemo.c, main/newdemo.h, main/piggy.c, main/titles.c: Placing FindArg calls to seperated function, putting variables to a struct - frist step, not finished, yet; Large code cleanup
20070629
--------

View file

@ -112,7 +112,6 @@ common_sources = [
'main/hash.c',
'main/hostage.c',
'main/hud.c',
'main/hudlog.c',
'main/ignore.c',
'main/inferno.c',
'main/ip_base.cpp',
@ -246,7 +245,6 @@ editor_sources = [
# for linux
arch_linux_sources = [
'arch/linux/arch_ip.cpp',
'arch/linux/init.c',
'arch/linux/ipx_bsd.c',
'arch/linux/ipx_kali.c',
'arch/linux/linuxnet.c',
@ -269,7 +267,6 @@ else:
arch_win32_sources = [
'arch/win32/arch_ip.cpp',
'arch/win32/hmpfile.c',
'arch/win32/init.c',
'arch/win32/ipx_win.c',
'arch/win32/midi.c',
'arch/win32/mono.c',

View file

@ -1,35 +0,0 @@
// linux init.c - added Matt Mueller 9/6/98
#include <stdlib.h>
#include <stdio.h>
#include "text.h"
#include "event.h"
#include "error.h"
#include "joy.h"
#include "args.h"
extern int Inferno_verbose;
extern void arch_sdl_init();
extern void arch_svgalib_init();
extern void key_init();
void arch_init_start()
{
}
void arch_init()
{
// Initialise the library
#ifdef __SDL__
arch_sdl_init();
#endif
#ifdef __SVGALIB__
arch_svgalib_init();
#endif
if (!FindArg( "-nojoystick" )) {
if (Inferno_verbose) printf( "\n%s", TXT_VERBOSE_6);
joy_init();
}
key_init();
}

View file

@ -6,6 +6,8 @@
#include "event.h"
#include "error.h"
#include "args.h"
#include "key.h"
#include "joy.h"
extern void d_mouse_init();
@ -16,21 +18,14 @@ void sdl_close()
void arch_sdl_init()
{
// Initialise the library
//edited on 01/03/99 by Matt Mueller - if we use SDL_INIT_EVERYTHING, cdrom is initialized even if -nocdaudio is used
if (SDL_Init(
#if SDL_VIDEO || SDL_GL
SDL_INIT_VIDEO
#else
0
#endif
)<0) {
//end edit -MM
Error("SDL library initialisation failed: %s.",SDL_GetError());
}
if (SDL_Init(SDL_INIT_VIDEO)<0)
Error("SDL library initialisation failed: %s.",SDL_GetError());
if (!FindArg("-nomouse"))
d_mouse_init();
atexit(sdl_close);
key_init();
joy_init();
if (!FindArg("-nomouse"))
d_mouse_init();
atexit(sdl_close);
}

View file

@ -429,10 +429,6 @@ int joy_get_scaled_reading( int raw, int axis_num )
#endif
}
void joy_set_slow_reading( int flag )
{
}
typedef struct Button_info {
ubyte ignore;
ubyte state;

View file

@ -1,40 +0,0 @@
/*
*
* mingw_init.c - Basically same as linux init.c
*
*/
#ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include "types.h"
#include "console.h"
#include "text.h"
#include "event.h"
#include "error.h"
#include "joy.h"
#include "args.h"
extern void arch_sdl_init();
extern void key_init();
void arch_init_start()
{
}
void arch_init()
{
// Initialise the library
arch_sdl_init();
if (!FindArg( "-nojoystick" )) {
if (Inferno_verbose) printf( "\n%s", TXT_VERBOSE_6);
joy_init();
}
key_init();
}

19
d1x.ini
View file

@ -4,23 +4,20 @@
;-nonicefps Disable CPU cycle freeing. Higher CPU load, but game may be smoother
;-maxfps <n> Set maximum framerate (1-80)
;-missiondir <d> Set alternate mission dir to <d> instead of missions/
;-hudlog Start hudlog immediately
;-lowmem Lowers animation detail for better performance with low memory
;-legacyhomers Activate original homing missiles (FPS and physics dependent)
;-pilot <pilot> Select this pilot-file automatically
;-autodemo Start in demo mode
Controls:
;-NoJoystick Disables joystick support
;-mouselook Activate mouselook. Works in singleplayer only
;-grabmouse Keeps the mouse from wandering out of the window
Sound:
;-Volume <v> Sets sound volume to v, where v is between 0 and 100
;-NoSound Disables sound drivers
;-NoMusic Disables music; sound effects remain enabled
;-music_ext <e> Use alternate external music files with extension <e> (requires SDL_mixer)
;-jukebox <d> Use jukebox for in-game music, load MP3/OGG files from directory <d> (requires SDL_mixer)
;-nosound Disables sound drivers
;-nomusic Disables music; sound effects remain enabled
Graphics:
@ -43,13 +40,6 @@
;-gl_voodoo Force fullscreen mode only
;-fixedfont Do not scale fonts to current resolution
Quickstart:
;-ini <file> Option file (alternate to command line), defaults to d1x.ini
;-notitles Do not show titlescreens on startup
;-pilot <pilot> Select this pilot-file automatically
;-autodemo Start in demo mode
Multiplayer:
;-mprofile <f> Use multi game profile <f>
@ -61,7 +51,6 @@
;-noredundancy Do not send messages when picking up redundant items in multiplayer
;-playermessages View only messages from other players in multi - overrides -noredundancy
;-handicap <n> Start game with <n> shields. Must be < 100 for multi
;-hudlog_multi Start hudlog upon entering multiplayer games
;-msgcolorlevel <c> To set message colorization level
; 0=none(old style) 1=color names in talk messages only(default)
; 2=also color names in kill/join/etc messages

View file

@ -1,11 +0,0 @@
// architecture specific things
#ifndef _ARCH_H
#define _ARCH_H
// called before anything else
void arch_init_start();
// called during startup
void arch_init();
#endif

View file

@ -11,38 +11,9 @@ 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: /cvsroot/dxx-rebirth/d1x-rebirth/include/args.h,v $
* $Revision: 1.1.1.1 $
* $Author: zicodxx $
* $Date: 2006/03/17 19:46:29 $
*
*
* Prototypes for accessing arguments.
*
* $Log: args.h,v $
* Revision 1.1.1.1 2006/03/17 19:46:29 zicodxx
* initial import
*
* Revision 1.1.1.1 1999/06/14 22:02:08 donut
* Import of d1x 1.37 source.
*
* 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
*
*
*/
@ -50,15 +21,35 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifndef _ARGS_H
#define _ARGS_H
extern int Num_args;
extern char * Args[];
extern int Num_args;
extern char * Args[];
extern int FindArg( char * s );
extern int FindResArg(char *prefix, int *sw, int *sh);
//added/edited on 1/11/99 by dph
extern void InitArgs( int argc, char **argv );
//end this section addition/change -dph
//added on 01/03/99 by Matt Mueller
extern int Inferno_verbose;
//end addition -MM
// Struct that keeps all variables used by FindArg
// Sys - System Options
// Ctl - Control Options
// Snd - Sound Options
// Gfx - Graphics Options
// Ogl - OpenGL Options
// Mpl - Multiplayer Options
// Dbg - Debugging/Undocumented Options
typedef struct Arg
{
int SysFPSIndicator;
int SysUseNiceFPS;
int SysMaxFPS;
char *SysMissionDir;
int SysLowMem;
int SysLegacyHomers;
char *SysPilot;
int SysAutoDemo;
int CtlMouselook;
int CtlGrabMouse;
} __attribute__ ((packed)) Arg;
extern struct Arg GameArg;
#endif

View file

@ -11,85 +11,31 @@ 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: /cvsroot/dxx-rebirth/d1x-rebirth/main/args.c,v $
* $Revision: 1.1.1.1 $
* $Author: zicodxx $
* $Date: 2006/03/17 19:42:49 $
*
*
* Functions for accessing arguments.
*
* $Log: args.c,v $
* Revision 1.1.1.1 2006/03/17 19:42:49 zicodxx
* initial import
*
* Revision 1.3 1999/08/05 22:53:41 sekmu
*
* D3D patch(es) from ADB
*
* Revision 1.2 1999/06/14 23:44:11 donut
* Orulz' svgalib/ggi/noerror patches.
*
* Revision 1.1.1.1 1999/06/14 22:05:15 donut
* Import of d1x 1.37 source.
*
* Revision 2.0 1995/02/27 11:31:22 john
* New version 2.0, which has no anonymous unions, builds with
* Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
*
* Revision 1.9 1994/11/29 01:07:57 john
* Took out some unused vars.
*
* Revision 1.8 1994/11/29 01:04:30 john
* Took out descent.ini stuff.
*
* Revision 1.7 1994/09/20 19:29:15 matt
* Made args require exact (not substring), though still case insensitive.
*
* Revision 1.6 1994/07/25 12:33:11 john
* Network "pinging" in.
*
* Revision 1.5 1994/06/17 18:07:50 matt
* Took out printf
*
* Revision 1.4 1994/05/11 19:45:33 john
* *** empty log message ***
*
* Revision 1.3 1994/05/11 18:42:11 john
* Added Descent.ini config file.
*
* Revision 1.2 1994/05/09 17:03:30 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:49:11 john
* Initial revision
*
*
*/
#ifdef RCS
static char rcsid[] = "$Id: args.c,v 1.1.1.1 2006/03/17 19:42:49 zicodxx Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "u_mem.h"
#include "strio.h"
//added 6/15/99 - Owen Evans
#include "strutil.h"
//end added - OE
#include "args.h"
#include "game.h"
#define MAX_ARGS 200
int Num_args=0;
char * Args[MAX_ARGS];
struct Arg GameArg;
int FindArg( char * s ) {
int i;
#ifndef NDEBUG
printf("FindArg call: %s\n",s);
printf("FindArg: %s\n",s);
#endif
for (i=0; i<Num_args; i++ )
@ -126,23 +72,12 @@ int FindResArg(char *prefix, int *sw, int *sh)
}
void args_exit(void)
{
int i;
for (i=0; i< Num_args; i++ )
free(Args[i]);
}
void AppendArgs(void)
void AppendIniArgs(void)
{
FILE *f;
char *line,*word;
int i;
if((i=FindArg("-ini")))
f=fopen(Args[i+1],"rt");
else
f=fopen("d1x.ini","rt");
f=fopen("d1x.ini","rt");
if(f) {
while(!feof(f) && Num_args < MAX_ARGS)
@ -161,6 +96,78 @@ void AppendArgs(void)
}
}
// All FindArg calls should be here to keep the code clean
void ReadCmdArgs(void)
{
int t;
// System Options
if (FindArg("-fps"))
GameArg.SysFPSIndicator = 1;
else
GameArg.SysFPSIndicator = 0;
if (FindArg("-nonicefps"))
GameArg.SysUseNiceFPS = 0;
else
GameArg.SysUseNiceFPS = 1;
if ((t = FindArg("-maxfps"))) {
t=atoi(Args[t+1]);
if (t>0&&t<=80)
GameArg.SysMaxFPS=t;
else
GameArg.SysMaxFPS=80;
}
else
GameArg.SysMaxFPS=80;
if ((t = FindArg("-missiondir")))
GameArg.SysMissionDir = Args[t+1];
else
GameArg.SysMissionDir = DESCENT_DATA_PATH "missions/";
if (FindArg("-lowmem"))
GameArg.SysLowMem = 1;
else
GameArg.SysLowMem = 0;
if (FindArg("-legacyhomers"))
GameArg.SysLegacyHomers = 1;
else
GameArg.SysLegacyHomers = 0;
if ((t = FindArg("-pilot")))
GameArg.SysPilot = Args[t+1];
else
GameArg.SysPilot = NULL;
if (FindArg("-autodemo"))
GameArg.SysAutoDemo = 1;
else
GameArg.SysAutoDemo = 0;
// Control Options
if (FindArg("-mouselook"))
GameArg.CtlMouselook = 1;
else
GameArg.CtlMouselook = 0;
if (FindArg("-grabmouse"))
GameArg.CtlGrabMouse = 1;
else
GameArg.CtlGrabMouse = 0;
}
void args_exit(void)
{
int i;
for (i=0; i< Num_args; i++ )
free(Args[i]);
}
void InitArgs( int argc,char **argv )
{
int i;
@ -174,7 +181,9 @@ void InitArgs( int argc,char **argv )
if ( Args[i][0] == '-' )
strlwr( Args[i] ); // Convert all args to lowercase
}
AppendArgs();
AppendIniArgs();
ReadCmdArgs();
atexit(args_exit);
}

View file

@ -1,216 +0,0 @@
/* cdplay.c by Victor Rachels for better management of cd player */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef __DJGPP__
#include "bcd.h"
//edited on 01/03/99 by Matt Mueller - should be ifdef'd for SDL, since SDL isn't linux specific
//I changed all the other ones too, but didn't feel like commenting them all
#elif defined __SDL__
//end edit -MM
#include <SDL/SDL.h>
#endif
#include "args.h"
#define MAX_TRACKS 20
int playlist[MAX_TRACKS];
int cd_currenttrack = 1;
int cd_playing = 0;
int cd_used = 0;
int tracks_used = MAX_TRACKS;
#ifdef __SDL__
SDL_CD *cdrom;
#endif
int nocdaudio=0;
int cd_playtrack(int trackno)
{
int track;
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return 0;
//end addition -MM
if(trackno > MAX_TRACKS || trackno < 0)
return 0;
track = playlist[trackno];
#ifdef __DJGPP__
if(bcd_play_track(&track))
#elif defined __SDL__
if(CD_INDRIVE(SDL_CDStatus(cdrom)) && !SDL_CDPlayTracks(cdrom,track,0,1,0))
#else
if(0)
#endif
cd_playing = 1;
else
cd_playing = 0;
cd_used = 1;
return cd_playing;
}
void cd_stop()
{
#ifdef __DJGPP__
bcd_stop();
#elif defined __SDL__
SDL_CDStop(cdrom);
#endif
cd_playing = 0;
}
int cd_resume()
{
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return 0;
//end addition -MM
#ifdef __DJGPP__
if(bcd_resume())
#elif defined __SDL__
if(CD_INDRIVE(SDL_CDStatus(cdrom)) && !SDL_CDResume(cdrom))
#else
if(0)
#endif
cd_playing = 1;
else
cd_playing = 0;
cd_used = 1;
return cd_playing;
}
void cd_playprev()
{
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return;
//end addition -MM
cd_currenttrack--;
if(cd_currenttrack < 0)
cd_currenttrack = tracks_used-1;
cd_playtrack(cd_currenttrack);
cd_used = 1;
}
void cd_playnext()
{
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return;
//end addition -MM
cd_currenttrack++;
if(cd_currenttrack >= tracks_used)
cd_currenttrack = 0;
cd_playtrack(cd_currenttrack);
cd_used = 1;
}
void cd_playtoggle()
{
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return;
//end addition -MM
#ifdef __DJGPP__
if(bcd_now_playing())
#elif defined __SDL__
if(SDL_CDStatus(cdrom)==CD_PLAYING)
#else
if(0)
#endif
{
cd_stop();
cd_playing=0;
}
else if(!cd_used)
{
cd_currenttrack = 0;
cd_playtrack(cd_currenttrack);
}
else
{
cd_resume();
}
cd_used = 1;
}
void cd_cycle()
{
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return;
//end addition -MM
#ifdef __DJGPP__
if(cd_playing && !bcd_now_playing())
#elif defined __SDL__
if(cd_playing && SDL_CDStatus(cdrom)!=CD_PLAYING)
#else
if(cd_playing && 0)
#endif
cd_playnext();
}
void cd_playlist_reset()
{
int i;
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return;
//end addition -MM
#ifdef __DJGPP__
tracks_used = bcd_get_audio_info();
#elif defined __SDL__
if(SDL_CDStatus(cdrom)>-1)
tracks_used = cdrom->numtracks;
else
tracks_used = 0;
#endif
for(i=0;i<tracks_used;i++)
playlist[i]=i+1;
for(i=tracks_used;i<MAX_TRACKS;i++)
playlist[i]=1;
}
void cd_playlist_set(char *newlist)
{
int i=0;
char *p=newlist;
//added on 01/03/99 by Matt Mueller
if (nocdaudio) return;
//end addition -MM
while((p==newlist || p-1) && i < MAX_TRACKS)
{
playlist[i++]=atoi(p);
p=strchr(p,' ')+1;
}
tracks_used = i;
}
void cd_init()
{
int i;
if ((nocdaudio=FindArg("-nocdaudio"))) {
if (Inferno_verbose) printf( "cd audio disabled.\n");
} else {
#ifdef __DJGPP__
bcd_open();
#elif defined __SDL__
if( SDL_Init(SDL_INIT_CDROM) >= 0 )
{
atexit(SDL_Quit);
cdrom=SDL_CDOpen(0);
}
#endif
cd_playlist_reset();
if((i=FindArg("-cdplaylist")))
cd_playlist_set(Args[i+1]);
}
}

View file

@ -1,20 +0,0 @@
/* cdplay.h by Victor Rachels for better management of cd player */
#ifndef _CDLIST_H
#define _CDLIST_H
int cd_playtrack(int trackno);
int cd_resume();
void cd_playprev();
void cd_playnext();
void cd_playtoggle();
void cd_stop();
void cd_cycle();
void cd_playlist_reset();
void cd_playlist_set(char *newlist);
void cd_init();
#endif

View file

@ -241,7 +241,6 @@ int ReadConfigFile()
int joy_axis_min[JOY_NUM_AXES];
int joy_axis_center[JOY_NUM_AXES];
int joy_axis_max[JOY_NUM_AXES];
int i;
strcpy( config_last_player, "" );
@ -381,16 +380,6 @@ int ReadConfigFile()
digi_midi_type = 1;
#endif
i = FindArg( "-volume" );
if ( i > 0 ) {
i = atoi( Args[i+1] );
if ( i < 0 ) i = 0;
if ( i > 100 ) i = 100;
Config_digi_volume = (i*8)/100;
Config_midi_volume = (i*8)/100;
}
if ( Config_digi_volume > 8 ) Config_digi_volume = 8;
if ( Config_midi_volume > 8 ) Config_midi_volume = 8;

View file

@ -103,8 +103,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "reorder.h"
#include "hudmsg.h"
#include "timer.h"
#include "cdplay.h"
#include "hudlog.h"
#ifdef NETWORK
#include "mlticntl.h"
#endif
@ -184,7 +182,6 @@ int Debug_pause=0; //John's debugging pause system
int Cockpit_mode=CM_FULL_COCKPIT; //set game.h for values
int old_cockpit_mode=-1;
int force_cockpit_redraw=0;
int framerate_on=0;
int netplayerinfo_on=0;
int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd;
int Dummy_var;
@ -214,9 +211,6 @@ grs_bitmap background_bitmap;
int Game_aborted;
void update_cockpits(int force_redraw);
extern void newdemo_strip_frames(char *, int);
#ifndef RELEASE
int invulnerability=0;
#endif
extern int HUD_nmessages;
#define BACKGROUND_NAME "statback.pcx"
@ -556,7 +550,7 @@ int set_screen_mode(int sm)
switch( Screen_mode ) {
case SCREEN_MENU:
/* give control back to the WM */
if (FindArg("-grabmouse"))
if (GameArg.CtlGrabMouse)
SDL_WM_GrabInput(SDL_GRAB_OFF);
if (grd_curscreen->sc_mode != MENU_SCREEN_MODE) {
@ -566,7 +560,7 @@ int set_screen_mode(int sm)
break;
case SCREEN_GAME:
/* keep the mouse from wandering in SDL */
if (FindArg("-grabmouse") && (Newdemo_state != ND_STATE_PLAYBACK))
if (GameArg.CtlGrabMouse && (Newdemo_state != ND_STATE_PLAYBACK))
SDL_WM_GrabInput(SDL_GRAB_ON);
if (grd_curscreen->sc_mode != Game_screen_mode)
@ -578,7 +572,7 @@ int set_screen_mode(int sm)
#ifdef EDITOR
case SCREEN_EDITOR:
/* give control back to the WM */
if (FindArg("-grabmouse"))
if (GameArg.CtlGrabMouse)
SDL_WM_GrabInput(SDL_GRAB_OFF);
if (grd_curscreen->sc_mode != SM(800,600)) {
@ -773,7 +767,6 @@ void reset_time()
}
int maxfps=80;
int use_nice_fps=1;
void calc_frame_time()
{
@ -788,7 +781,7 @@ void calc_frame_time()
while (FrameTime < f1_0 / maxfps)
{
if (use_nice_fps)
if (GameArg.SysUseNiceFPS)
timer_delay(f1_0 / maxfps - FrameTime);
timer_value = timer_get_fixed_seconds();
FrameTime = timer_value - last_timer_value;
@ -1070,7 +1063,7 @@ void game_draw_hud_stuff()
}
}
if (framerate_on)
if (GameArg.SysFPSIndicator)
show_framerate();
#ifdef NETWORK
@ -1835,14 +1828,14 @@ void game()
game_flush_inputs();
}
if ( (Function_mode != FMODE_GAME) && Auto_demo && (Newdemo_state != ND_STATE_NORMAL) ) {
if ( (Function_mode != FMODE_GAME) && GameArg.SysAutoDemo && (Newdemo_state != ND_STATE_NORMAL) ) {
int choice, fmode;
fmode = Function_mode;
Function_mode = FMODE_GAME;
choice=nm_messagebox( NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_AUTODEMO );
Function_mode = fmode;
if (choice==0) {
Auto_demo = -1;
GameArg.SysAutoDemo = 0;
newdemo_stop_playback();
Function_mode = FMODE_MENU;
} else {
@ -1917,8 +1910,6 @@ extern void john_cheat_func_4(int);
//called at the end of the program
void close_game()
{
close_hud_log();
if (VR_offscreen_buffer) {
gr_free_canvas(VR_offscreen_buffer);
VR_offscreen_buffer = NULL;
@ -2226,11 +2217,6 @@ void HandleGameKey(int key)
break;
#endif
case KEY_ALTED+KEY_F8:
#ifdef NETWORK
mekh_hud_recall_msgs();
#endif
break;
#ifdef NETWORK
case KEY_SHIFTED+KEY_F8:
mekh_resend_last();
@ -2266,9 +2252,6 @@ void HandleGameKey(int key)
case KEYS_GR_TOGGLE_FULLSCREEN:
gr_toggle_fullscreen_game();
break;
case KEY_CTRLED+KEY_ALTED+KEY_LAPOSTRO:
toggle_hud_log();
break;
case KEY_SHIFTED + KEY_ESC: //quick exit
#ifdef EDITOR
if (! SafetyCheck()) break;
@ -2408,7 +2391,7 @@ void HandleGameKey(int key)
break;
}
case KEY_DEBUGGED+KEY_F:
framerate_on = !framerate_on;
GameArg.SysFPSIndicator = !GameArg.SysFPSIndicator;
break;
case KEY_DEBUGGED+KEY_SPACEBAR: // Toggle physics flying
slew_stop();
@ -2665,7 +2648,7 @@ void ReadControls()
john_cheat_func_2(key);
#ifdef FINAL_CHEATS
IMPLEMENT_CHEAT(frametime,framerate_on = !framerate_on;);
IMPLEMENT_CHEAT(frametime,GameArg.SysFPSIndicator = !GameArg.SysFPSIndicator;);
IMPLEMENT_CHEAT(renderstats,gr_renderstats = !gr_renderstats;);
if (Cheats_enabled) {
if (!(Game_mode&GM_MULTI) && key == cheat_wowie[cheat_wowie_index]) {
@ -2944,11 +2927,6 @@ void GameLoop(int RenderFlag, int ReadControlsFlag )
Error ("Loading overlay -- error number: %d\n", (int)desc_id_exit_num);
}
#ifndef RELEASE
if (invulnerability)
Players[Player_num].flags |= PLAYER_FLAGS_INVULNERABLE;
#endif
update_player_stats();
diminish_palette_towards_normal(); // Should leave palette effect up for as long as possible by putting right before render.
do_cloak_stuff();

View file

@ -236,11 +236,10 @@ extern grs_canvas VR_screen_sub_pages[2]; // Two sub pages of VRAM if paging is
extern grs_canvas *VR_offscreen_menu; // The offscreen data buffer for menus
void game_init_render_buffers (int render_max_w, int render_max_h, int render_method);
extern int maxfps;
extern int use_nice_fps;
extern int Allow_primary_cycle;
extern int Allow_secondary_cycle;
void vr_reset_display();
#endif

View file

@ -1661,8 +1661,6 @@ rgb player_rgb[] = { {15,15,23},
{14,21,12},
{29,29,0}, };
extern int hud_display_all;
//draw the reticle
void show_reticle(int force_big_one)
{
@ -1670,10 +1668,6 @@ void show_reticle(int force_big_one)
int laser_ready,missile_ready,laser_ammo,missile_ammo;
int cross_bm_num,primary_bm_num,secondary_bm_num;
if (hud_display_all)
return;
x = grd_curcanv->cv_w/2;
y = grd_curcanv->cv_h/2;

View file

@ -25,8 +25,8 @@ static char rcsid[] = "$Id: hud.c,v 1.1.1.1 2006/03/17 19:42:04 zicodxx Exp $";
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include "hudlog.h"
#include "hudmsg.h"
#include "inferno.h"
#include "game.h"
@ -44,117 +44,154 @@ static char rcsid[] = "$Id: hud.c,v 1.1.1.1 2006/03/17 19:42:04 zicodxx Exp $";
#include "screens.h"
#include "text.h"
#include "args.h"
#include "strutil.h"
int hud_first = 0;
int hud_last = 0;
int HUD_max_num_disp = 4; //max to display normally
int hudlog_first = 0;
int hudlog_num = 0;
int hud_display_all = 0;
int HUD_nmessages = 0;
fix HUD_message_timer = 0; // Time, relative to Players[Player_num].time (int.frac seconds.frac), at which to erase gauge message
char HUD_messages[HUD_MAX_NUM][HUD_MESSAGE_LENGTH+5];
int HUD_max_num_disp = 3; //max to display normally
int HUD_nmessages = 0;
fix HUD_message_timer = 0; // Time, relative to Players[Player_num].time (int.frac seconds.frac), at which to erase gauge message
char HUD_messages[HUD_MAX_NUM][HUD_MESSAGE_LENGTH+5];
char Displayed_background_message[HUD_MESSAGE_LENGTH] = "";
int Last_msg_ycrd = -1;
int Last_msg_height = 6;
int HUD_color = -1;
int Last_msg_ycrd = -1;
int Last_msg_height = 6;
int HUD_color = -1;
int MSG_Playermessages = 0;
int MSG_Noredundancy = 0;
// -----------------------------------------------------------------------------
int Modex_hud_msg_count;
// ----------------------------------------------------------------------------
void clear_background_messages(void)
{
if ((Cockpit_mode == CM_STATUS_BAR) && (Last_msg_ycrd != -1) && (Screen_3d_window.cv_bitmap.bm_y >= 6)) {
if (((Cockpit_mode == CM_STATUS_BAR) || (Cockpit_mode == CM_FULL_SCREEN)) && (Last_msg_ycrd != -1) && (Screen_3d_window.cv_bitmap.bm_y >= 6)) {
grs_canvas *canv_save = grd_curcanv;
gr_set_current_canvas(NULL);
gr_set_current_canvas(canv_save);
Displayed_background_message[0] = 0;
Last_msg_ycrd = -1;
}
Displayed_background_message[0] = 0;
}
void HUD_clear_messages()
{
int i;
HUD_nmessages = 0;
hud_first = hud_last;
hud_first = hud_last = 0;
HUD_message_timer = 0;
clear_background_messages();
for (i = 0; i < HUD_MAX_NUM; i++)
sprintf(HUD_messages[i], "SlagelSlagel!!");
}
extern int max_window_h;
extern grs_canvas *print_to_canvas(char *s,grs_font *font, int fc, int bc, int double_flag);
// -----------------------------------------------------------------------------
// print to buffer, double heights, and blit bitmap to screen
void modex_hud_message(int x, int y, char *s, grs_font *font, int color)
{
grs_canvas *temp_canv;
temp_canv = print_to_canvas(s, font, color, -1, 1);
gr_bitmapm(x,y,&temp_canv->cv_bitmap);
gr_free_canvas(temp_canv);
}
extern int max_window_w;
// ----------------------------------------------------------------------------
// Writes a message on the HUD and checks its timer.
void HUD_render_message_frame()
{
int i, y,n;
int h,w,aw;
int first,num;
if (hud_display_all){
first=hudlog_first;
num=hudlog_num;
}else{
first=hud_first;
num=HUD_nmessages;
}
if (( HUD_nmessages < 0 ) || (HUD_nmessages > HUD_MAX_NUM))
Int3(); // Get Rob!
if ( num < 1 ) return;
if ( (HUD_nmessages < 1 ) && (Modex_hud_msg_count == 0))
return;
if (HUD_nmessages > 0 ) {
HUD_message_timer -= FrameTime;
HUD_message_timer -= FrameTime;
if ( HUD_message_timer < 0 ) {
// Timer expired... get rid of oldest message...
if (hud_last!=hud_first) {
hud_first = (hud_first+1) % HUD_MAX_NUM;
HUD_message_timer = F1_0*2;
HUD_nmessages--;
clear_background_messages(); // If in status bar mode and no messages, then erase.
}
if ( HUD_message_timer < 0 ) {
// Timer expired... get rid of oldest message...
if (hud_last!=hud_first) {
int temp;
//&HUD_messages[hud_first][0] is deing deleted...;
hud_first = (hud_first+1) % HUD_MAX_NUM;
HUD_message_timer = F1_0*2;
HUD_nmessages--;
if (HUD_nmessages == 0)
Modex_hud_msg_count = 2;
temp = Last_msg_ycrd;
clear_background_messages(); // If in status bar mode and no messages, then erase.
if (Modex_hud_msg_count)
Last_msg_ycrd = temp;
}
}
if (num > 0 ) {
if (HUD_nmessages > 0 ) {
gr_set_curfont( GAME_FONT );
if (HUD_color == -1)
HUD_color = BM_XRGB(0,28,0);
y = 3;
gr_get_string_size("0", &w, &h, &aw );
i= num - (grd_curcanv->cv_bitmap.bm_h-y)/(h+1);//fit as many as possible
if (i<0) i=0;
for (; i<num; i++ ) {
n = (first+i) % HUD_MAX_NUM;
gr_set_curfont( GAME_FONT );
if ( (Cockpit_mode == CM_FULL_SCREEN) || (Cockpit_mode == CM_LETTERBOX) ) {
y = GAME_FONT->ft_h/2;
} else
y = GAME_FONT->ft_h/2;
for (i=0; i<HUD_nmessages; i++ ) {
n = (hud_first+i) % HUD_MAX_NUM;
if ((n < 0) || (n >= HUD_MAX_NUM))
Int3(); // Get Rob!!
if (!strcmp(HUD_messages[n], "This is a bug."))
Int3(); // Get Rob!!
gr_get_string_size(HUD_messages[n], &w, &h, &aw );
gr_get_string_size(&HUD_messages[n][0], &w, &h, &aw );
gr_set_fontcolor( HUD_color, -1);
gr_printf((grd_curcanv->cv_bitmap.bm_w-w)/2,y, HUD_messages[n] );
gr_string((grd_curcanv->cv_bitmap.bm_w-w)/2,y, &HUD_messages[n][0] );
y += h+FONTSCALE_Y(1);
}
}
gr_set_curfont( GAME_FONT );
}
void mekh_hud_recall_msgs()
{
hud_display_all = !hud_display_all;
}
int PlayerMessage=1;
void HUD_init_message(char * format, va_list args)
// Call to flash a message on the HUD. Returns true if message drawn.
// (message might not be drawn if previous message was same)
int HUD_init_message_va(char * format, va_list args)
{
int temp, i;
char *message = NULL;
char *last_message=NULL;
time_t t;
struct tm *lt;
Modex_hud_msg_count = 2;
if ( (hud_last < 0) || (hud_last >= HUD_MAX_NUM))
Int3(); // Get Rob!!
message = HUD_messages[hud_last];
// -- mprintf((0, "message timer: %7.3f\n", f2fl(HUD_message_timer)));
message = &HUD_messages[hud_last][0];
vsprintf(message,format,args);
// clean message if necessary.
@ -164,17 +201,26 @@ void HUD_init_message(char * format, va_list args)
if (message[i] == '%')
message [i] = ' ';
// Added by Leighton
if ((Game_mode & GM_MULTI) && FindArg("-noredundancy"))
if (!strnicmp ("You already",message,11))
return 0;
if ((Game_mode & GM_MULTI) && FindArg("-PlayerMessages") && PlayerMessage==0)
return 0;
if (HUD_nmessages > 0) {
if (hud_last==0)
last_message = HUD_messages[HUD_MAX_NUM-1];
last_message = &HUD_messages[HUD_MAX_NUM-1][0];
else
last_message = HUD_messages[hud_last-1];
last_message = &HUD_messages[hud_last-1][0];
}
temp = (hud_last+1) % HUD_MAX_NUM;
if ( temp==hudlog_first ) {
hudlog_first= (hudlog_first+1) % HUD_MAX_NUM;
hudlog_num--;
if ( temp==hud_first ) {
hud_first= (hud_first+1) % HUD_MAX_NUM;
hud_last--;
}
if ( HUD_nmessages>=HUD_max_num_disp){
// If too many messages, remove oldest message to make room
@ -184,7 +230,14 @@ void HUD_init_message(char * format, va_list args)
if (last_message && (!strcmp(last_message, message))) {
HUD_message_timer = F1_0*3; // 1 second per 5 characters
return; // ignore since it is the same as the last one
return 0; // ignore since it is the same as the last one
}
if (strnicmp ("you",message,3)) { // block hudlog output messages beginning with you ("your ... maxed out", "you already have ...")
t=time(NULL);
lt=localtime(&t);
printf("%02i:%02i:%02i %s\n",lt->tm_hour,lt->tm_min,lt->tm_sec,message);
}
hud_last = temp;
@ -197,45 +250,59 @@ void HUD_init_message(char * format, va_list args)
#endif
HUD_message_timer = F1_0*3; // 1 second per 5 characters
HUD_nmessages++;
hudlog_num++;
hud_log_message(message);
return 1;
}
int HUD_init_message(char * format, ... )
{
int ret;
va_list args;
va_start(args, format);
ret = HUD_init_message_va(format, args);
va_end(args);
return ret;
}
void player_dead_message(void)
{
if (Player_exploded) {
if ( Players[Player_num].lives < 2 ) {
int x, y, w, h, aw;
gr_set_curfont(Gamefonts[GFONT_BIG_1]);
gr_get_string_size( TXT_GAME_OVER, &w, &h, &aw );
w += 20;
h += 8;
x = (GWIDTH - w ) / 2;
y = (GHEIGHT - h ) / 2;
Gr_scanline_darkening_level = 2*7;
gr_setcolor( BM_XRGB(0,0,0) );
gr_rect( x, y, x+w, y+h );
Gr_scanline_darkening_level = GR_FADE_LEVELS;
gr_string(0x8000, (GHEIGHT - FONTSCALE_Y(grd_curcanv->cv_font->ft_h))/2 + h/8, TXT_GAME_OVER );
}
gr_set_curfont( GAME_FONT );
if (HUD_color == -1)
HUD_color = BM_XRGB(0,28,0);
gr_set_fontcolor( HUD_color, -1);
gr_string(0x8000, GHEIGHT-FONTSCALE_Y(grd_curcanv->cv_font->ft_h+3)*((Newdemo_state == ND_STATE_RECORDING)?2:1), TXT_PRESS_ANY_KEY);
}
if (Player_exploded) {
if ( Players[Player_num].lives < 2 ) {
int x, y, w, h, aw;
gr_set_curfont( Gamefonts[GFONT_BIG_1] );
gr_get_string_size( TXT_GAME_OVER, &w, &h, &aw );
w += 20;
h += 8;
x = (GWIDTH - w ) / 2;
y = (GHEIGHT - h ) / 2;
Gr_scanline_darkening_level = 2*7;
gr_setcolor( BM_XRGB(0,0,0) );
gr_rect( x, y, x+w, y+h );
Gr_scanline_darkening_level = GR_FADE_LEVELS;
gr_string(0x8000, (GHEIGHT - FONTSCALE_Y(grd_curcanv->cv_font->ft_h))/2 + h/8, TXT_GAME_OVER );
}
gr_set_curfont( GAME_FONT );
if (HUD_color == -1)
HUD_color = BM_XRGB(0,28,0);
gr_set_fontcolor( HUD_color, -1);
gr_string(0x8000, GHEIGHT-FONTSCALE_Y(grd_curcanv->cv_font->ft_h+3)*((Newdemo_state == ND_STATE_RECORDING)?2:1), TXT_PRESS_ANY_KEY);
}
}
void hud_message(int class, char *format, ...)
{
va_list vp;
va_start(vp, format);
if ((!MSG_Noredundancy || (class & MSGC_NOREDUNDANCY)) &&
(!MSG_Playermessages || !(Game_mode & GM_MULTI) ||
(class & MSGC_PLAYERMESSAGES)))
HUD_init_message(format, vp);
va_end(vp);
va_list vp;
va_start(vp, format);
if ((!MSG_Noredundancy || (class & MSGC_NOREDUNDANCY)) &&
(!MSG_Playermessages || !(Game_mode & GM_MULTI) ||
(class & MSGC_PLAYERMESSAGES)))
HUD_init_message_va(format, vp);
va_end(vp);
}

View file

@ -1,202 +0,0 @@
//hudlog.c added 11/01/98 Matthew Mueller - log messages and score grid to files.
#include <time.h>
#include <stdio.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#else
#include <io.h>
#define access(a,b) _access(a,b)
#endif
#include "hudmsg.h"
#include "multi.h"
#include "hudlog.h"
#include "strutil.h"
//added on 9/5/99 by Victor Rachels for \ or / usage
#include "d_slash.h"
//end this section addition -VR
int HUD_log_multi_autostart = 0;
int HUD_log_autostart = 0;
int fhudmulti = 0;
FILE *fhudlog=NULL;
char hudlogname[143];
void hud_log_check_multi_start(void){
#ifdef NETWORK
if ((Game_mode & GM_MULTI) && HUD_log_multi_autostart){
if (!fhudlog || !fhudmulti)
open_hud_log();//don't reopen the log file (for example, when changing levels in a multi player game)
}
#endif
}
void hud_log_check_multi_stop(void){
#ifdef NETWORK
if (HUD_log_multi_autostart && fhudmulti){
close_hud_log();
}
#endif
}
void open_hud_log(void){
static int num=0;
//edited 02/06/99 Matthew Mueller - changed filename to include date
time_t t;
struct tm *lt;
if (fhudlog)close_hud_log();
#ifdef NETWORK
fhudmulti = Game_mode & GM_MULTI;
#endif
t=time(NULL);
lt=localtime(&t);
do{
// sprintf(hudlogname,"%shud%05d.log",hudlogdir,num++);
//edited 03/22/99 Matthew Mueller - tm_mon is 0 based.
sprintf(hudlogname,"%04d%02d%02d.%03d",lt->tm_year+1900,lt->tm_mon+1,lt->tm_mday,num++);
//end edit -MM
//end edit -MM
}while (!access(hudlogname,0));
if (!(fhudlog=fopen(hudlogname,"w"))){
hud_message(MSGC_GAME_FEEDBACK,"error opening %s",hudlogname);
return;
}
hud_message(MSGC_GAME_FEEDBACK,"logging messages to %s",hudlogname);
}
static int recurse_flag=0;
void close_hud_log(void){
if (fhudlog){
++recurse_flag;
kmatrix_log(1);
hud_message(MSGC_GAME_FEEDBACK,"closing hud log file");
fclose(fhudlog);
fhudlog=NULL;
--recurse_flag;
}
}
void toggle_hud_log(void){
if (fhudlog)close_hud_log();
else open_hud_log();
}
void hud_log_message(char * message){
// printf("hud_log_message %i %i %i %p: %s\n",recurse_flag,HUD_log_autostart,HUD_log_multi_autostart,fhudlog,message);
if (++recurse_flag==1){//avoid infinite loop. doh.
if (fhudlog){
#ifdef NETWORK
if (HUD_log_multi_autostart && ((Game_mode & GM_MULTI) != fhudmulti))
close_hud_log();//if we are using -hudlog_multi, presumably we would want multiplayer games in seperate log files than single player, so close the log file and let a new one be reopened if needed.
#endif
}
if (!fhudlog){
if (HUD_log_autostart)
open_hud_log();
#ifdef NETWORK
else if ((Game_mode & GM_MULTI) && HUD_log_multi_autostart){
open_hud_log();
}
#endif
}
}
--recurse_flag;
if (strnicmp ("you",message,3)) { // block hudlog output messages beginning with you ("your ... maxed out", "you already have ...")
time_t t;
struct tm *lt;
t=time(NULL);
lt=localtime(&t);
//02/06/99 Matthew Mueller - added zero padding to hour
printf("%02i:%02i:%02i ",lt->tm_hour,lt->tm_min,lt->tm_sec);
if (fhudlog)
fprintf(fhudlog,"%02i:%02i:%02i ",lt->tm_hour,lt->tm_min,lt->tm_sec);
while (*message){
if (*message>=0x01 && *message<=0x03){//filter out color codes
message++;
if (!*message)break;
}else if (*message>=0x04 && *message<=0x06){//filter out color reset code
}else{
printf("%c",*message);
if (fhudlog)
fprintf(fhudlog,"%c",*message);
}
message++;
}
printf("\n");
}
if (fhudlog){
fprintf(fhudlog,"\n");
//added 05/17/99 Matt Mueller - flush file to make sure it all gets out there
fflush(fhudlog);
//end addition -MM
}
//end edit -MM
}
void kmatrix_print(FILE* out,int *sorted){
#ifdef NETWORK
int i,j;
time_t t;
struct tm *lt;
t=time(NULL);
lt=localtime(&t);
//added 05/19/99 Matt Mueller - print mission name
fprintf(out,"Mission: ");
#ifndef SHAREWARE
if(!Netgame.mission_name)
#endif
fprintf(out,"Descent: First Strike\n");
#ifndef SHAREWARE
else
fprintf(out,"%s\n",Netgame.mission_name);
#endif
//end addition -MM
fprintf(out,"%2i:%02i:%02i ",lt->tm_hour,lt->tm_min,lt->tm_sec);
for (j=0; j<N_players; j++)
fprintf(out,"%9s",Players[sorted[j]].callsign);
fprintf(out,"%9s\n","kills");
for (i=0; i<N_players; i++){
fprintf(out,"%9s",Players[sorted[i]].callsign);
for (j=0; j<N_players; j++){
if (sorted[i]==sorted[j]) {
if (kill_matrix[sorted[i]][sorted[j]] == 0)
fprintf(out,"%9d",kill_matrix[sorted[i]][sorted[j]]);
else
fprintf(out,"%9d",-kill_matrix[sorted[i]][sorted[j]]);
}else{
fprintf(out,"%9d",kill_matrix[sorted[i]][sorted[j]]);
}
}
fprintf(out,"%9d\n",Players[sorted[i]].net_kills_total);
}
fprintf(out,"%9s","deaths:");
for (j=0; j<N_players; j++)
fprintf(out,"%9d",Players[sorted[j]].net_killed_total);
fprintf(out,"\n");
//added 05/19/99 Matt Mueller - flush file to make sure it all gets out there
fflush(out);
//end addition -MM
#endif
}
void kmatrix_log(int fhudonly){
#ifdef NETWORK
int sorted[MAX_NUM_NET_PLAYERS];
if (!(Game_mode & GM_MULTI)) return;
multi_sort_kill_list();
multi_get_kill_list(sorted);
if (fhudlog)
kmatrix_print(fhudlog,sorted);
if (!fhudonly)
kmatrix_print(stdout,sorted);
#endif
}

View file

@ -1,12 +0,0 @@
//hudlog.h added 11/01/98 Matthew Mueller - log messages and score grid to files.
void hud_log_check_multi_start(void);
void open_hud_log(void);
void close_hud_log(void);
void toggle_hud_log(void);
void kmatrix_log(int fhudonly);
void hud_log_message(char * message);
extern int HUD_log_multi_autostart;
extern int HUD_log_autostart;

View file

@ -10,29 +10,13 @@ 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.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/inferno.c,v $
* $Revision: 1.3 $
* $Author: michaelstather $
* $Date: 2006/03/19 14:41:26 $
/*
*
* main() for Inferno
*
* $Log: inferno.c,v $
* Revision 1.3 2006/03/19 14:41:26 michaelstather
* Cleaned up command line arguments
* Reformatting
*
* Revision 1.2 2006/03/18 23:08:13 michaelstather
* New build system by KyroMaster
*
* Revision 1.1.1.1 2006/03/17 19:44:36 zicodxx
* initial import
*/
#ifdef RCS
static char rcsid[] = "$Id: inferno.c,v 1.3 2006/03/19 14:41:26 michaelstather Exp $";
#endif
#ifdef __GNUC__
static char copyright[] = "DESCENT COPYRIGHT (C) 1994,1995 PARALLAX SOFTWARE CORPORATION";
static char *__reference[2]={copyright,(char *)__reference};
@ -112,19 +96,15 @@ static char *__reference[2]={copyright,(char *)__reference};
#include "cfile.h"
#include "gameseq.h"
#include "timer.h"
#include "joy.h"
#include "key.h"
#include "mono.h"
#include "palette.h"
#include "bm.h"
#include "screens.h"
#include "arch.h"
#include "hudmsg.h"
#include "playsave.h"
#include "d_io.h"
#include "automap.h"
#include "hudlog.h"
#include "cdplay.h"
#include "ban.h"
#include "gauges.h"
#include "pingstat.h"
@ -136,7 +116,7 @@ static char *__reference[2]={copyright,(char *)__reference};
#include "collide.h"
#include "newdemo.h"
void show_order_form();
extern void arch_sdl_init(void);
static const char desc_id_checksum_str[] = DESC_ID_CHKSUM;
char desc_id_exit_num = 0;
@ -216,19 +196,18 @@ void show_commandline_help()
printf( " -nonicefps %s\n", "Disable CPU cycle freeing. Higher CPU load, but game may be smoother");
printf( " -maxfps <n> %s\n", "Set maximum framerate (1-80)");
printf( " -missiondir <d> %s\n", "Set alternate mission dir to <d> instead of missions/");
printf( " -hudlog %s\n", "Start hudlog immediately");
printf( " -lowmem %s\n", "Lowers animation detail for better performance with low memory");
printf( " -legacyhomers %s\n", "Activate original homing missiles (FPS and physics dependent)");
printf( " -pilot <pilot> %s\n", "Select this pilot-file automatically");
printf( " -autodemo %s\n", "Start in demo mode");
printf( "\n Controls:\n\n");
printf( " -NoJoystick %s\n", "Disables joystick support");
printf( " -mouselook %s\n", "Activate mouselook. Works in singleplayer only");
printf( " -grabmouse %s\n", "Keeps the mouse from wandering out of the window");
printf( "\n Sound:\n\n");
printf( " -Volume <v> %s\n", "Sets sound volume to v, where v is between 0 and 100");
printf( " -NoSound %s\n", "Disables sound drivers");
printf( " -NoMusic %s\n", "Disables music; sound effects remain enabled");
printf( " -nosound %s\n", "Disables sound drivers");
printf( " -nomusic %s\n", "Disables music; sound effects remain enabled");
printf( "\n Graphics:\n\n");
printf( " -menu<X>x<Y> %s\n", "Set menu-resolution to <X> by <Y> instead of game-resolution");
@ -253,12 +232,6 @@ void show_commandline_help()
printf( " -fixedfont %s\n", "Do not scale fonts to current resolution");
#endif // OGL
printf( "\n Quickstart:\n\n");
printf( " -ini <file> %s\n", "Option file (alternate to command line), defaults to d1x.ini");
printf( " -notitles %s\n", "Do not show titlescreens on startup");
printf( " -pilot <pilot> %s\n", "Select this pilot-file automatically");
printf( " -autodemo %s\n", "Start in demo mode");
#ifdef NETWORK
printf( "\n Multiplayer:\n\n");
printf( " -mprofile <f> %s\n", "Use multi game profile <f>");
@ -270,7 +243,6 @@ void show_commandline_help()
printf( " -noredundancy %s\n", "Do not send messages when picking up redundant items in multiplayer");
printf( " -playermessages %s\n", "View only messages from other players in multi - overrides -noredundancy");
printf( " -handicap <n> %s\n", "Start game with <n> shields. Must be < 100 for multi");
printf( " -hudlog_multi %s\n", "Start hudlog upon entering multiplayer games");
printf( " -msgcolorlevel <c> %s\n", "Level of colorization for hud messages\n\t\t\t0=none(old style)\n\t\t\t1=color names in talk messages only(default)\n\t\t\t2=also color names in kill/join/etc messages\n\t\t\t3=talk messages are fully colored, not just names");
#ifdef SUPPORTS_NET_IP
printf( " -ip_nogetmyaddr %s\n", "Prevent autodetection of local ip address");
@ -317,20 +289,14 @@ void show_commandline_help()
}
extern fix fixed_frametime;
extern int framerate_on;
extern void vfx_set_palette_sub(ubyte *);
extern int mouselook;
extern int newhomers;
#ifndef RELEASE
extern int invulnerability;
#endif
int Inferno_verbose = 0;
int start_net_immediately = 0;
int main(int argc,char **argv)
{
int i,t;
int t;
u_int32_t screen_mode = SM(640,480);
error_init(NULL);
@ -344,9 +310,6 @@ int main(int argc,char **argv)
if ( FindArg( "-verbose" ) )
Inferno_verbose = 1;
// Things to initialize before anything else
arch_init_start();
if (!cfexist(DESCENT_DATA_PATH "descent.hog") || !cfexist(DESCENT_DATA_PATH "descent.pig"))
Error("Could not find valid descent.hog and/or descent.pig in\n"
#ifdef __unix__
@ -372,10 +335,7 @@ int main(int argc,char **argv)
printf("\nType 'd1x-rebirth-gl/sdl -help' for a list of command-line options.\n");
if ((t = FindArg( "-missiondir" )))
cfile_use_alternate_hogdir(Args[t+1]);
else
cfile_use_alternate_hogdir(DESCENT_DATA_PATH "missions/");
cfile_use_alternate_hogdir(GameArg.SysMissionDir);
if ((t=FindArg("-tmap")))
select_tmap(Args[t+1]);
@ -406,12 +366,6 @@ int main(int argc,char **argv)
HUD_max_num_disp = t;
}
if (FindArg("-hudlog_multi"))
HUD_log_multi_autostart = 1;
if (FindArg("-hudlog"))
HUD_log_autostart = 1;
if (FindArg("-noredundancy"))
MSG_Noredundancy = 1;
@ -427,12 +381,6 @@ int main(int argc,char **argv)
handicap=t;
}
if ((t = FindArg( "-maxfps" ))) {
t=atoi(Args[t+1]);
if (t>0&&t<=80)
maxfps=t;
}
#ifdef NETWORK
if(FindArg( "-startnetgame" ))
start_net_immediately = 1;
@ -449,38 +397,13 @@ int main(int argc,char **argv)
if(FindArg( "-fastext" ))
extfaster=1;
if (FindArg("-mouselook"))
mouselook=1;
else
mouselook=0;
if (FindArg("-legacyhomers"))
newhomers = 0;
if (FindArg("-persistentdebris"))
persistent_debris=1;
if ( FindArg( "-fps" ))
framerate_on = 1;
if ( FindArg( "-nonicefps" ))
use_nice_fps = 0;
if ( FindArg( "-autodemo" ))
Auto_demo = 1;
#ifndef RELEASE
if ( FindArg( "-noscreens" ) )
Skip_briefing_screens = 1;
if ( FindArg( "-invulnerability") )
invulnerability = 1;
#endif
if (Inferno_verbose)
printf ("%s", TXT_VERBOSE_1);
arch_init();
arch_sdl_init();
if (init_graphics()) return 1;
@ -542,16 +465,8 @@ int main(int argc,char **argv)
gamefont_init(); // must load after palette data loaded.
songs_play_song( SONG_TITLE, 1 );
#ifndef QUICKSTART
#ifndef SHAREWARE
if ( !FindArg( "-notitles" ) )
#endif
{
show_title_screen( "iplogo1.pcx", 1 );
show_title_screen( "logo.pcx", 1 );
}
#endif
show_title_screen( "iplogo1.pcx", 1 );
show_title_screen( "logo.pcx", 1 );
show_title_screen( "descent.pcx", 2 );
#ifdef SHAREWARE
@ -573,10 +488,8 @@ int main(int argc,char **argv)
mprintf( (0, "\nInitializing 3d system..." ));
g3_init();
mprintf( (0, "\nInitializing texture caching system..." ));
if (FindArg( "-lowmem" ))
texmerge_init( 10 ); // if we are low on mem, only use 10 cache bitmaps
else
texmerge_init( 9999 ); // otherwise, use as much as possible (its still limited by the #define in texmerge.c, so it won't actually use 9999) -MM
texmerge_init( 10 ); // 10 cache bitmaps
mprintf( (0, "\nRunning game...\n" ));
#ifdef SCRIPT
script_init();
@ -589,17 +502,12 @@ int main(int argc,char **argv)
Players[Player_num].callsign[0] = '\0';
key_flush();
#ifdef QUICKSTART
strcpy(Players[Player_num].callsign, config_last_player);
read_player_file();
Auto_leveling_on = Default_leveling_on;
write_player_file();
#else
if((i=FindArg("-pilot")))
if(GameArg.SysPilot)
{
char filename[15];
int j;
snprintf(filename, 12, Args[i+1]);
snprintf(filename, 12, GameArg.SysPilot);
for (j=0; filename[j] != '\0'; j++) {
switch (filename[j]) {
case ' ':
@ -624,7 +532,6 @@ int main(int argc,char **argv)
else
if(!RegisterPlayer())
Function_mode = FMODE_EXIT;
#endif
gr_palette_fade_out( NULL, 32, 0 );
@ -634,23 +541,6 @@ int main(int argc,char **argv)
t = build_mission_list(0); // This also loads mission 0.
#endif
#ifdef QUICKSTART
Difficulty_level = Player_default_difficulty;
Skip_briefing_screens = 1;
{
int default_mission = 0;
for (i=0;i<t;i++) {
if ( !strcasecmp( Mission_list[i].mission_name, config_last_mission ) )
default_mission = i;
}
load_mission(default_mission);
}
Function_mode = FMODE_GAME;
StartNewGame(1);
game();
#endif
while (Function_mode != FMODE_EXIT)
{
switch( Function_mode ) {

View file

@ -96,7 +96,6 @@ fix Cruise_speed=0;
int Allow_primary_cycle=1;
int Allow_secondary_cycle=1;
int mouselook=0;
extern int Automap_flag;
#define LHX(x) ((x)*(hiresfont && SWIDTH>=640 && SHEIGHT>=480?FONTSCALE_X(2):FONTSCALE_X(1)))
@ -2098,7 +2097,7 @@ void controls_read_all()
mprintf( (1, "Bogus frame time of %.2f seconds\n", f2fl(FrameTime) ));
// ZICO - remove clamp for pitch and heading if mouselook on and no multiplayer game
if ((Config_control_type != 5) || !mouselook || (Game_mode & GM_MULTI) ) {
if ((Config_control_type != 5) || !GameArg.CtlMouselook || (Game_mode & GM_MULTI) ) {
if (Controls.pitch_time > FrameTime/2 ) Controls.pitch_time = FrameTime/2;
if (Controls.heading_time > FrameTime ) Controls.heading_time = FrameTime;
if (Controls.pitch_time < -FrameTime/2 ) Controls.pitch_time = -FrameTime/2;

View file

@ -116,6 +116,7 @@ static char rcsid[] = "$Id: kmatrix.c,v 1.1.1.1 2006/03/17 19:44:38 zicodxx Exp
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <time.h>
#include "error.h"
#include "types.h"
@ -140,7 +141,6 @@ static char rcsid[] = "$Id: kmatrix.c,v 1.1.1.1 2006/03/17 19:44:38 zicodxx Exp
#include "gauges.h"
#include "pcx.h"
#include "network.h"
#include "hudlog.h"
#ifdef OGL
#include "ogl_init.h"
@ -358,7 +358,5 @@ void kmatrix_view(int network)
gr_palette_fade_out( gr_palette, 32, 0 );
game_flush_inputs();
kmatrix_log(0);
}
#endif

View file

@ -68,8 +68,6 @@ int Laser_rapid_fire = 0;
int Laser_drop_vulcan_ammo = 0;
int newhomers = 1;
int find_homing_object_complete(vms_vector *curpos, object *tracker, int track_obj_type1, int track_obj_type2);
//---------------------------------------------------------------------------------
@ -1088,7 +1086,7 @@ void Laser_do_weapon_sequence(object *obj)
}
if (track_goal != -1) {
if (newhomers)
if (!GameArg.SysLegacyHomers)
{
fix turn_radius;

View file

@ -165,8 +165,7 @@ void autodemo_menu_check(int nitems, newmenu_item * items, int *last_key, int ci
if ( do_auto_demo ) {
curtime = timer_get_approx_seconds();
//if ( ((keyd_time_when_last_pressed+i2f(20)) < curtime) && ((last_joy_time+i2f(20)) < curtime) && (!speedtest_on) ) {
if ( (((keyd_time_when_last_pressed+i2f(45)) < curtime) && (!speedtest_on)) || Auto_demo == 1 ) {
if ( (((keyd_time_when_last_pressed+i2f(45)) < curtime) && (!speedtest_on)) || GameArg.SysAutoDemo == 1 ) {
keyd_time_when_last_pressed = curtime; // Reset timer so that disk won't thrash if no demos.
newdemo_start_playback(NULL); // Randomly pick a file
if (Newdemo_state == ND_STATE_PLAYBACK) {

View file

@ -77,10 +77,6 @@ static char rcsid[] = "$Id: multi.c,v 1.1.1.1 2006/03/17 19:43:22 zicodxx Exp $"
#include "ignore.h"
//End addition by GRiM FisH
//added 11/01/98 Matt Mueller
#include "hudlog.h"
//end addition -MM
//added 11/01/98 Matt Mueller
#include "pingstat.h"
//end addition -MM
@ -1015,10 +1011,6 @@ multi_leave_game(void)
if (!(Game_mode & GM_MULTI))
return;
//added 11/01/98 by Matthew Mueller
kmatrix_log(0);
//end addition -MM
if (Game_mode & GM_NETWORK)
{
mprintf((0, "Sending explosion message.\n"));

View file

@ -11,11 +11,6 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#ifdef RCS
static char rcsid[] = "$Id: newdemo.c,v 1.1.1.1 2006/03/17 19:44:19 zicodxx Exp $";
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h> // for memset
@ -87,8 +82,6 @@ static char rcsid[] = "$Id: newdemo.c,v 1.1.1.1 2006/03/17 19:44:19 zicodxx Exp
#include "editor/editor.h"
#endif
//Does demo start automatically?
int Auto_demo = 0;
void DoJasonInterpolate (fix recorded_time);
#define ND_EVENT_EOF 0 // EOF

View file

@ -11,165 +11,11 @@ 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: /cvsroot/dxx-rebirth/d1x-rebirth/main/newdemo.h,v $
* $Revision: 1.1.1.1 $
* $Author: zicodxx $
* $Date: 2006/03/17 19:44:19 $
*
*
* .
*
* $Log: newdemo.h,v $
* Revision 1.1.1.1 2006/03/17 19:44:19 zicodxx
* initial import
*
* Revision 1.1.1.1 1999/06/14 22:12:47 donut
* Import of d1x 1.37 source.
*
* Revision 2.0 1995/02/27 11:27:18 john
* New version 2.0, which has no anonymous unions, builds with
* Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
*
* Revision 1.43 1995/01/19 09:41:43 allender
* prototype for laser level recording
*
* Revision 1.42 1995/01/18 18:48:49 allender
* added function prototype for door_open
*
* Revision 1.41 1995/01/17 17:42:31 allender
* new prototypes for ammo counts
*
* Revision 1.40 1995/01/04 15:04:27 allender
* added some different prototypes for registered
*
* Revision 1.39 1995/01/03 11:45:11 allender
* extern function definition
*
* Revision 1.38 1994/12/29 16:43:31 allender
* new function prototype
*
* Revision 1.37 1994/12/28 14:15:27 allender
* new function prototypes
*
* Revision 1.36 1994/12/21 12:46:41 allender
* new functions for multiplayer deaths and kills
*
* Revision 1.35 1994/12/12 11:32:55 allender
* added new record function to restore after in rearview mode
*
* Revision 1.34 1994/12/08 21:03:15 allender
* added new param to record_player_flags
*
* Revision 1.33 1994/12/08 13:47:01 allender
* removed function call to record_rearview
*
* Revision 1.32 1994/12/06 12:57:10 allender
* added new prototype for multi decloaking
*
* Revision 1.31 1994/12/01 11:46:34 allender
* added recording prototype for multi player cloak
*
* Revision 1.30 1994/11/27 23:04:22 allender
* function prototype for recording new levels
*
* Revision 1.29 1994/11/07 08:47:43 john
* Made wall state record.
*
* Revision 1.28 1994/11/05 17:22:53 john
* Fixed lots of sequencing problems with newdemo stuff.
*
* Revision 1.27 1994/11/04 16:48:49 allender
* extern Newdemo_do_interpolate variable
*
* Revision 1.26 1994/11/02 14:08:53 allender
* record rearview
*
* Revision 1.25 1994/10/31 13:35:04 allender
* added two record functions to save and restore cockpit state on
* death sequence
*
* Revision 1.24 1994/10/29 16:01:11 allender
* added ND_STATE_NODEMOS to indicate that there are no demos currently
* available for playback
*
* Revision 1.23 1994/10/28 12:41:58 allender
* add homing distance recording event
*
* Revision 1.22 1994/10/27 16:57:32 allender
* removed VCR_MODE stuff, and added monitor blowup effects
*
* Revision 1.21 1994/10/26 14:44:48 allender
* completed hacked in vcr type demo playback states
*
* Revision 1.20 1994/10/26 13:40:38 allender
* more vcr demo playback defines
*
* Revision 1.19 1994/10/26 08:51:26 allender
* record player weapon change
*
* Revision 1.18 1994/10/25 16:25:31 allender
* prototypes for shield, energy and flags
*
* Revision 1.17 1994/08/15 18:05:30 john
* *** empty log message ***
*
* Revision 1.16 1994/07/21 13:11:26 matt
* Ripped out remants of old demo system, and added demo only system that
* disables object movement and game options from menu.
*
* Revision 1.15 1994/07/05 12:49:02 john
* Put functionality of New Hostage spec into code.
*
* Revision 1.14 1994/06/27 15:53:12 john
* #define'd out the newdemo stuff
*
*
* Revision 1.13 1994/06/24 17:01:25 john
* Add VFX support; Took Game Sequencing, like EndGame and stuff and
* took it out of game.c and into gameseq.c
*
* Revision 1.12 1994/06/21 19:46:05 john
* Added palette effects to demo recording.
*
* Revision 1.11 1994/06/21 14:19:58 john
* Put in hooks to record HUD messages.
*
* Revision 1.10 1994/06/20 11:50:42 john
* Made demo record flash effect, and control center triggers.
*
* Revision 1.9 1994/06/17 18:01:29 john
* A bunch of new stuff by John
*
* Revision 1.8 1994/06/17 12:13:34 john
* More newdemo stuff; made editor->game transition start in slew mode.
*
* Revision 1.7 1994/06/16 13:02:02 john
* Added morph hooks.
*
* Revision 1.6 1994/06/15 19:01:42 john
* Added the capability to make 3d sounds play just once for the
* laser hit wall effects.
*
* Revision 1.5 1994/06/15 14:57:11 john
* Added triggers to demo recording.
*
* Revision 1.4 1994/06/14 20:42:19 john
* Made robot matztn cntr not work until no robots or player are
* in the segment.
*
* Revision 1.3 1994/06/14 14:43:52 john
* Made doors work with newdemo system.
*
* Revision 1.2 1994/06/13 21:02:44 john
* Initial version of new demo recording system.
*
* Revision 1.1 1994/06/13 15:51:09 john
* Initial revision
*
*
*/
#ifndef _NEWDEMO_H
#define _NEWDEMO_H
@ -195,9 +41,6 @@ extern int Newdemo_game_mode;
extern int Newdemo_vcr_state;
extern sbyte Newdemo_do_interpolate;
//Does demo start automatically?
extern int Auto_demo;
// Functions called during recording process...
extern void newdemo_record_start_demo();
extern void newdemo_record_start_frame(int frame_number, fix frame_time );

View file

@ -435,8 +435,6 @@ int Num_sound_files_new = 0;
static BitmapFile AllBitmaps[ MAX_BITMAP_FILES ];
static SoundFile AllSounds[ MAX_SOUND_FILES ];
int piggy_low_memory = 0;
#define DBM_FLAG_LARGE 128 // Flags added onto the flags struct in b
#define DBM_FLAG_ABM 64
@ -726,13 +724,7 @@ int piggy_init()
if ( FindArg( "-bigpig" ))
BigPig = 1;
if ( FindArg( "-lowmem" ))
piggy_low_memory = 1;
if ( FindArg( "-nolowmem" ))
piggy_low_memory = 0;
if (piggy_low_memory)
if (GameArg.SysLowMem)
digi_lomem = 1;
if ( (i=FindArg( "-piggy" )) ) {
@ -968,7 +960,7 @@ void piggy_bitmap_page_in( bitmap_index bitmap )
if ( GameBitmapOffset[i] == 0 ) return; // A read-from-disk bitmap!!!
if ( piggy_low_memory ) {
if ( GameArg.SysLowMem ) {
org_i = i;
i = GameBitmapXlat[i]; // Xlat for low-memory settings!
}
@ -1036,7 +1028,7 @@ void piggy_bitmap_page_in( bitmap_index bitmap )
start_time();
}
if ( piggy_low_memory ) {
if ( GameArg.SysLowMem ) {
if ( org_i != i )
GameBitmaps[org_i] = GameBitmaps[i];
}

View file

@ -68,8 +68,6 @@ char Briefing_text_filename[13] = "briefing.tex";
#define SHAREWARE_ENDING_FILENAME "ending.tex"
// Can be set by -noscreens command line option. Causes bypassing of all briefing screens.
int Skip_briefing_screens=0;
int Briefing_foreground_colors[MAX_BRIEFING_COLORS], Briefing_background_colors[MAX_BRIEFING_COLORS];
int Current_color = 0;
int Erase_color;
@ -1085,11 +1083,6 @@ int show_briefing_screen( int screen_num, int allow_keys)
New_pal_254_bash = 0;
if (Skip_briefing_screens) {
mprintf((0, "Skipping briefing screen [%s]\n", &Briefing_screens[screen_num].bs_name));
return 0;
}
gr_init_bitmap_data (&briefing_bm);
if ((pcx_error=pcx_read_bitmap( Briefing_screens_LH[screen_num].bs_name, &briefing_bm, BM_LINEAR, New_pal ))!=PCX_ERROR_NONE) {
@ -1130,11 +1123,6 @@ void do_briefing_screens(int level_num)
int abort_briefing_screens = 0;
int cur_briefing_screen = 0;
if (Skip_briefing_screens) {
mprintf((0, "Skipping all briefing screens.\n"));
return;
}
if (!Briefing_text_filename[0]) //no filename?
return;