@ -35,27 +35,22 @@ int setseed;
int PauseMode ;
bool forceSpawn ;
bool forceDiablo ;
BOOLEAN UseTheoQuest ;
BOOLEAN UseCowFarmer ;
BOOLEAN UseNestArt ;
BOOLEAN UseBardTest ;
BOOLEAN UseBarbarianTest ;
BOOLEAN UseMultiTest ;
bool gbTheoQuest ;
bool gbCowQuest ;
bool gbNestArt ;
bool gbBard ;
bool gbBarbarian ;
int sgnTimeoutCurs ;
char sgbMouseDown ;
int color_cycle_timer ;
int ticks_per_sec = 20 ;
WORD tick_d elay = 50 ;
int gnTickRate ;
WORD gnTickD elay = 50 ;
/** Game options */
Options sgOptions ;
/* rdata */
/**
* Specifies whether to give the game exclusive access to the
* screen , as needed for efficient rendering in fullscreen mode .
*/
BOOL fullscreen = TRUE ;
bool gbForceWindowed = false ;
bool gbShowIntro = true ;
BOOL leveldebug ;
# ifdef _DEBUG
@ -110,8 +105,6 @@ static void print_help_and_exit()
printf ( " %-20s %-30s \n " , " --barbariantest " , " Enable the Barbarian class " ) ;
printf ( " \n Hellfire options: \n " ) ;
printf ( " %-20s %-30s \n " , " --diablo " , " Force diablo mode even if hellfire.mpq is found " ) ;
printf ( " %-20s %-30s \n " , " --theoquest " , " Enable the Theo quest " ) ;
printf ( " %-20s %-30s \n " , " --cowquest " , " Enable the Cow quest " ) ;
printf ( " %-20s %-30s \n " , " --nestart " , " Use alternate nest palette " ) ;
# ifdef _DEBUG
printf ( " \n Debug options: \n " ) ;
@ -153,21 +146,17 @@ static void diablo_parse_flags(int argc, char **argv)
} else if ( strcasecmp ( " -f " , argv [ i ] ) = = 0 ) {
EnableFrameCount ( ) ;
} else if ( strcasecmp ( " -x " , argv [ i ] ) = = 0 ) {
fullscreen = FALSE ;
gbForceWindowed = true ;
} else if ( strcasecmp ( " --spawn " , argv [ i ] ) = = 0 ) {
forceSpawn = TRUE ;
} else if ( strcasecmp ( " --diablo " , argv [ i ] ) = = 0 ) {
forceDiablo = TRUE ;
} else if ( strcasecmp ( " --theoquest " , argv [ i ] ) = = 0 ) {
UseTheoQuest = TRUE ;
} else if ( strcasecmp ( " --cowquest " , argv [ i ] ) = = 0 ) {
UseCowFarmer = TRUE ;
} else if ( strcasecmp ( " --nestart " , argv [ i ] ) = = 0 ) {
UseNestArt = TRUE ;
gbNestArt = true ;
} else if ( strcasecmp ( " --bardtest " , argv [ i ] ) = = 0 ) {
UseBardTest = TRUE ;
gbBard = true ;
} else if ( strcasecmp ( " --barbariantest " , argv [ i ] ) = = 0 ) {
UseBarbarianTest = TRUE ;
gbBarbarian = true ;
# ifdef _DEBUG
} else if ( strcasecmp ( " -^ " , argv [ i ] ) = = 0 ) {
debug_mode_key_inverted_v = TRUE ;
@ -413,8 +402,33 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer)
*/
static void SaveOptions ( )
{
SRegSaveValue ( " devilutionx " , " game speed " , 0 , sgOptions . ticksPerSecound ) ;
SRegSaveValue ( " devilutionx " , " blended transparency " , 0 , sgOptions . blendedTransparancy ) ;
setIniInt ( " Audio " , " Sound Volume " , sgOptions . nSoundVolume ) ;
setIniInt ( " Audio " , " Music Volume " , sgOptions . nMusicVolume ) ;
setIniInt ( " Audio " , " Walking Sound " , sgOptions . bWalkingSound ) ;
# ifdef __vita__
setIniInt ( " Graphics " , " Width " , sgOptions . nWidth ) ;
setIniInt ( " Graphics " , " Height " , sgOptions . nHeight ) ;
# endif
setIniInt ( " Graphics " , " Fullscreen " , sgOptions . bFullscreen ) ;
# ifdef __vita__
setIniInt ( " Graphics " , " Upscale " , sgOptions . bUpscale ) ;
# endif
setIniInt ( " Graphics " , " Fit to Screen " , sgOptions . bFitToScreen ) ;
setIniValue ( " Graphics " , " Scaling Quality " , sgOptions . szScaleQuality ) ;
setIniInt ( " Graphics " , " Integer Scaling " , sgOptions . bIntegerScaling ) ;
setIniInt ( " Graphics " , " Vertical Sync " , sgOptions . bVSync ) ;
setIniInt ( " Graphics " , " Blended Transparency " , sgOptions . bBlendedTransparancy ) ;
setIniInt ( " Graphics " , " Gamma Correction " , sgOptions . nGammaCorrection ) ;
setIniInt ( " Graphics " , " Color Cycling " , sgOptions . bColorCycling ) ;
setIniInt ( " Game " , " Speed " , sgOptions . nTickRate ) ;
setIniInt ( " Game " , " Fast Walk " , sgOptions . bJogInTown ) ;
setIniInt ( " Game " , " Grab Input " , sgOptions . bGrabInput ) ;
setIniInt ( " Game " , " Theo Quest " , sgOptions . bTheoQuest ) ;
setIniInt ( " Game " , " Cow Quest " , sgOptions . bCowQuest ) ;
setIniValue ( " Network " , " Bind Address " , sgOptions . szBindAddress ) ;
}
/**
@ -422,9 +436,38 @@ static void SaveOptions()
*/
static void LoadOptions ( )
{
sgOptions . ticksPerSecound = ticks_per_sec ;
SRegLoadValue ( " devilutionx " , " game speed " , 0 , & sgOptions . ticksPerSecound ) ;
sgOptions . blendedTransparancy = getIniBool ( " devilutionx " , " blended transparency " , true ) ;
sgOptions . nSoundVolume = getIniInt ( " Audio " , " Sound Volume " , VOLUME_MAX ) ;
sgOptions . nMusicVolume = getIniInt ( " Audio " , " Music Volume " , VOLUME_MAX ) ;
sgOptions . bWalkingSound = getIniBool ( " Audio " , " Walking Sound " , true ) ;
# ifndef __vita__
sgOptions . nWidth = getIniInt ( " Graphics " , " Width " , DEFAULT_WIDTH ) ;
sgOptions . nHeight = getIniInt ( " Graphics " , " Height " , DEFAULT_HEIGHT ) ;
# else
sgOptions . nWidth = DEFAULT_WIDTH ;
sgOptions . nHeight = DEFAULT_HEIGHT ;
# endif
sgOptions . bFullscreen = getIniBool ( " Graphics " , " Fullscreen " , true ) ;
# if !defined(USE_SDL1) && !defined(__vita__)
sgOptions . bUpscale = getIniBool ( " Graphics " , " Upscale " , true ) ;
# else
sgOptions . bUpscale = false ;
# endif
sgOptions . bFitToScreen = getIniBool ( " Graphics " , " Fit to Screen " , true ) ;
getIniValue ( " Graphics " , " Scaling Quality " , sgOptions . szScaleQuality , sizeof ( sgOptions . szScaleQuality ) , " 2 " ) ;
sgOptions . bIntegerScaling = getIniBool ( " Graphics " , " Integer Scaling " , false ) ;
sgOptions . bVSync = getIniBool ( " Graphics " , " Vertical Sync " , true ) ;
sgOptions . bBlendedTransparancy = getIniBool ( " Graphics " , " Blended Transparency " , true ) ;
sgOptions . nGammaCorrection = getIniInt ( " Graphics " , " Gamma Correction " , 100 ) ;
sgOptions . bColorCycling = getIniBool ( " Graphics " , " Color Cycling " , true ) ;
sgOptions . nTickRate = getIniInt ( " Game " , " Speed " , 20 ) ;
sgOptions . bJogInTown = getIniBool ( " Game " , " Fast Walk " , false ) ;
sgOptions . bGrabInput = getIniBool ( " Game " , " Grab Input " , false ) ;
sgOptions . bTheoQuest = getIniBool ( " Game " , " Theo Quest " , false ) ;
sgOptions . bCowQuest = getIniBool ( " Game " , " Cow Quest " , false ) ;
getIniValue ( " Network " , " Bind Address " , sgOptions . szBindAddress , sizeof ( sgOptions . szBindAddress ) , " 0.0.0.0 " ) ;
}
static void diablo_init_screen ( )
@ -482,7 +525,8 @@ static void diablo_splash()
if ( gbIsHellfire & & getIniBool ( " Hellfire " , " Intro " , true ) ) {
play_movie ( " gendata \\ Hellfire.smk " , TRUE ) ;
setIniValue ( " Hellfire " , " Intro " , " 0 " ) ;
} else if ( ! gbIsSpawn & & getIniBool ( " Diablo " , " Intro " , true ) ) {
}
if ( ! gbIsHellfire & & ! gbIsSpawn & & getIniBool ( " Diablo " , " Intro " , true ) ) {
play_movie ( " gendata \\ diablo1.smk " , TRUE ) ;
setIniValue ( " Diablo " , " Intro " , " 0 " ) ;
}
@ -494,7 +538,6 @@ static void diablo_deinit()
{
if ( was_snd_init ) {
effects_cleanup_sfx ( ) ;
sound_cleanup ( ) ;
}
if ( was_ui_init )
UiDestroy ( ) ;
@ -1901,7 +1944,7 @@ void game_loop(BOOL bStartup)
{
int i ;
i = bStartup ? ticks_per_sec * 3 : 3 ;
i = bStartup ? gnTickRate * 3 : 3 ;
while ( i - - ) {
if ( ! multi_handle_delta ( ) ) {
@ -1918,7 +1961,7 @@ void game_loop(BOOL bStartup)
void diablo_color_cyc_logic ( )
{
if ( ! palette_get_color_cycling ( ) )
if ( ! sgOptions . bColorCycling )
return ;
if ( leveltype = = DTYPE_HELL ) {