From e80490d431d940f1e549c3a0426a5815d0be4dbf Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 17 May 2009 13:54:19 +0000 Subject: Always use an SDL buffer size that is a power of two. Reduce buffer size to 70ms. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1524 --- pcsound/pcsound_sdl.c | 31 +++++++++++++++++++++++++++++-- src/i_sdlsound.c | 35 +++++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/pcsound/pcsound_sdl.c b/pcsound/pcsound_sdl.c index 546e6a36..6ba06785 100644 --- a/pcsound/pcsound_sdl.c +++ b/pcsound/pcsound_sdl.c @@ -32,7 +32,7 @@ #include "pcsound.h" #include "pcsound_internal.h" -#define SOUND_SLICE_TIME 100 /* ms */ +#define MAX_SOUND_SLICE_TIME 70 /* ms */ #define SQUARE_WAVE_AMP 0x2000 // If true, we initialised SDL and have the responsibility to shut it @@ -164,6 +164,33 @@ static void PCSound_SDL_Shutdown(void) } } +// Calculate slice size, based on MAX_SOUND_SLICE_TIME. +// The result must be a power of two. + +static int GetSliceSize(void) +{ + int limit; + int n; + + limit = (pcsound_sample_rate * MAX_SOUND_SLICE_TIME) / 1000; + + // Try all powers of two, not exceeding the limit. + + for (n=0;; ++n) + { + // 2^n <= limit < 2^n+1 ? + + if ((1 << (n + 1)) > limit) + { + return (1 << n); + } + } + + // Should never happen? + + return 1024; +} + static int PCSound_SDL_Init(pcsound_callback_func callback_func) { int slicesize; @@ -179,7 +206,7 @@ static int PCSound_SDL_Init(pcsound_callback_func callback_func) return 0; } - slicesize = (SOUND_SLICE_TIME * pcsound_sample_rate) / 1000; + slicesize = GetSliceSize(); if (Mix_OpenAudio(pcsound_sample_rate, AUDIO_S16SYS, 2, slicesize) < 0) { diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c index 34adf9de..cdb771e9 100644 --- a/src/i_sdlsound.c +++ b/src/i_sdlsound.c @@ -49,7 +49,7 @@ #include "doomdef.h" #define LOW_PASS_FILTER -#define SOUND_SLICE_TIME 100 /* ms */ +#define MAX_SOUND_SLICE_TIME 70 /* ms */ #define NUM_CHANNELS 16 static boolean sound_initialised = false; @@ -65,7 +65,6 @@ int use_libsamplerate = 0; extern int mb_used; - // When a sound stops, check if it is still playing. If it is not, // we can mark the sound data as CACHE to be freed back for other // means. @@ -667,10 +666,36 @@ static void I_SDL_ShutdownSound(void) sound_initialised = false; } +// Calculate slice size, based on MAX_SOUND_SLICE_TIME. +// The result must be a power of two. + +static int GetSliceSize(void) +{ + int limit; + int n; + + limit = (snd_samplerate * MAX_SOUND_SLICE_TIME) / 1000; + + // Try all powers of two, not exceeding the limit. + + for (n=0;; ++n) + { + // 2^n <= limit < 2^n+1 ? + + if ((1 << (n + 1)) > limit) + { + return (1 << n); + } + } + + // Should never happen? + + return 1024; +} + static boolean I_SDL_InitSound(void) { int i; - int slicesize; // No sounds yet @@ -690,9 +715,7 @@ static boolean I_SDL_InitSound(void) return false; } - slicesize = (snd_samplerate * SOUND_SLICE_TIME) / 1000; - - if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, slicesize) < 0) + if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, GetSliceSize()) < 0) { fprintf(stderr, "Error initialising SDL_mixer: %s\n", Mix_GetError()); return false; -- cgit v1.2.3 From 1c78ab7f5f69f49114a150d28c0c7506b14198f1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 18 May 2009 18:30:49 +0000 Subject: Fix A_BossDeath behavior in v1.9 emulation mode (thanks entryway) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1525 --- src/p_enemy.c | 122 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 55 insertions(+), 67 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4729dbc5..760bbbc8 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -1612,6 +1612,57 @@ void A_Explode (mobj_t* thingy) P_RadiusAttack(thingy, thingy->target, 128); } +// Check whether the death of the specified monster type is allowed +// to trigger the end of episode special action. +// +// This behavior changed in v1.9, the most notable effect of which +// was to break uac_dead.wad + +static boolean CheckBossEnd(mobjtype_t motype) +{ + if (gameversion < exe_ultimate) + { + if (gamemap != 8) + { + return false; + } + + // Baron death on later episodes is nothing special. + + if (motype == MT_BRUISER && gameepisode != 1) + { + return false; + } + + return true; + } + else + { + // New logic that appeared in Ultimate Doom. + // Looks like the logic was overhauled while adding in the + // episode 4 support. Now bosses only trigger on their + // specific episode. + + switch(gameepisode) + { + case 1: + return gamemap == 8 && motype == MT_BRUISER; + + case 2: + return gamemap == 8 && motype == MT_CYBORG; + + case 3: + return gamemap == 8 && motype == MT_SPIDER; + + case 4: + return (gamemap == 6 && motype == MT_CYBORG) + || (gamemap == 8 && motype == MT_SPIDER); + + default: + return gamemap == 8; + } + } +} // // A_BossDeath @@ -1636,75 +1687,12 @@ void A_BossDeath (mobj_t* mo) } else { - switch(gameepisode) - { - case 1: - if (gamemap != 8) - return; - - // fraggle: disable this as it breaks uac_dead.wad. - // There is at least one version of Doom 1.9 which it is - // possible to play uac_dead through on. I think this was - // added here for Ultimate Doom. - // - // See lmps/doom/ultimate/uac_dead.zip in idgames for - // an example of a demo which goes out of sync if this - // is left in here. - // - // For the time being, I'm making the assumption that - // doing this is not going to break anything else. - // - // 2005/10/24: Modify this to test the gameversion setting - - if (gameversion >= exe_ultimate && mo->type != MT_BRUISER) - return; - break; - - case 2: - if (gamemap != 8) - return; - - if (mo->type != MT_CYBORG) - return; - break; - - case 3: - if (gamemap != 8) - return; - - if (mo->type != MT_SPIDER) - return; - - break; - - case 4: - switch(gamemap) - { - case 6: - if (mo->type != MT_CYBORG) - return; - break; - - case 8: - if (mo->type != MT_SPIDER) - return; - break; - - default: - return; - break; - } - break; - - default: - if (gamemap != 8) - return; - break; - } - + if (!CheckBossEnd(mo->type)) + { + return; + } } - // make sure there is a player alive for victory for (i=0 ; i 0) -- cgit v1.2.3 From 2a60e32a3a2b0001a2dc9fc7391a2afcadb0bfa9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 19 May 2009 17:07:49 +0000 Subject: Fix manpage documentation for DOOMWADPATH (thanks MikeRS) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1526 --- man/manpage.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/manpage.template b/man/manpage.template index 0b090cf9..052ccb63 100644 --- a/man/manpage.template +++ b/man/manpage.template @@ -18,9 +18,9 @@ behavior. .TP \fBDOOMWADDIR\fR, \fBDOOMWADPATH\fR These environment variables provide paths to search for Doom .WAD files when -looking for a game IWAD file or a PWAD file specified with the '-file' option. +looking for a game IWAD file or a PWAD file specified with the `-file' option. \fBDOOMWADDIR\fR specifies a single path in which to look for WAD files, -while \fBDOOMWWADDIR\fR specifies a colon-separated list of paths to search. +while \fBDOOMWWADPATH\fR specifies a colon-separated list of paths to search. .TP \fBPCSOUND_DRIVER\fR When running in PC speaker sound effect mode, this environment variable -- cgit v1.2.3 From bd20fc62a36475e7a9fff269784d0f1e5c1128b4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 21 May 2009 19:18:38 +0000 Subject: Set display settings window position based on screen dimensions, rather than hard coding position. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1527 --- setup/display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/display.c b/setup/display.c index 5e9d4fcf..7bcf0d5b 100644 --- a/setup/display.c +++ b/setup/display.c @@ -384,7 +384,8 @@ void ConfigDisplay(void) window = TXT_NewWindow("Display Configuration"); - TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, 40, 5); + TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, + TXT_SCREEN_W / 2, 5); TXT_AddWidgets(window, fs_checkbox = TXT_NewCheckBox("Fullscreen", &fullscreen), -- cgit v1.2.3