Skip to content

Commit

Permalink
Merge branch 'master' into id24_sbardef
Browse files Browse the repository at this point in the history
  • Loading branch information
rfomin committed Oct 2, 2024
2 parents f5d5cd1 + 7b63671 commit a7c2a9d
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 84 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ jobs:
runs-on: ${{ matrix.config.os }}

strategy:
fail-fast: false
matrix:
config:
- name: Linux GCC
os: ubuntu-22.04
toolchain: $VCPKG_INSTALLATION_ROOT
triplet: x64-linux-dynamic-release
artifact-name: AppImage
artifact-path: build/*.appimage
Expand All @@ -31,6 +33,7 @@ jobs:
- name: MSVC x64
os: windows-latest
arch: x64
toolchain: ${env:VCPKG_INSTALLATION_ROOT}
triplet: x64-windows-static-release
artifact-name: Win-64
artifact-path: build/*.zip
Expand All @@ -42,6 +45,7 @@ jobs:
- name: MSVC x86
os: windows-latest
arch: x86
toolchain: ${env:VCPKG_INSTALLATION_ROOT}
triplet: x86-windows-static-release
artifact-name: Win-32
artifact-path: build/*.zip
Expand Down Expand Up @@ -74,21 +78,12 @@ jobs:
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Update vcpkg (Linux)
if: runner.os == 'Linux'
run: |
cd "$VCPKG_INSTALLATION_ROOT"
git stash
git pull
./bootstrap-vcpkg.sh
- name: Configure
shell: bash
run: >-
cmake -B build -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DENABLE_WERROR=ON -DENABLE_HARDENING=ON -DENABLE_LTO=ON
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-DCMAKE_TOOLCHAIN_FILE="${{ matrix.config.toolchain }}/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_OVERLAY_TRIPLETS="cmake/triplets"
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }}
${{ matrix.config.extra-options }}
Expand Down
4 changes: 3 additions & 1 deletion src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ static boolean FilterDeathUseAction(void)
case death_use_nothing:
return true;
case death_use_reload:
if (!demoplayback && !demorecording && !netgame)
if (!demoplayback && !demorecording && !netgame
&& !activate_death_use_reload)
{
activate_death_use_reload = true;
}
Expand Down Expand Up @@ -953,6 +954,7 @@ void G_ClearInput(void)
I_ResetRelativeMouseState();
I_ResetAllRumbleChannels();
WS_Reset();
activate_death_use_reload = false;
}

//
Expand Down
14 changes: 11 additions & 3 deletions src/i_midimusic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,9 +1321,12 @@ static boolean I_MID_InitMusic(int device)
return true;
}

// MIDI CC#7 volume formula (GM Level 1 Developer Guidelines, page 9).
#define MIDI_DB_TO_GAIN(db) powf(10.0f, (db) / 40.0f)

static void UpdateVolumeFactor(int volume)
{
volume_factor = sqrtf(volume / 15.0f) * midi_gain / 100.0f;
volume_factor = volume / 15.0f * MIDI_DB_TO_GAIN(midi_gain);
}

static void I_MID_SetMusicVolume(int volume)
Expand Down Expand Up @@ -1485,6 +1488,11 @@ static const char **I_MID_DeviceList(void)
return midi_devices;
}

static midiplayertype_t I_MID_MidiPlayerType(void)
{
return midiplayer_native;
}

static void I_MID_BindVariables(void)
{
BIND_NUM_MIDI(midi_complevel, COMP_STANDARD, 0, COMP_NUM - 1,
Expand All @@ -1495,8 +1503,7 @@ static void I_MID_BindVariables(void)
"Delay after reset for native MIDI (-1 = Auto; 0 = None; 1-2000 = Milliseconds)");
BIND_BOOL_MIDI(midi_ctf, true,
"Fix invalid instruments by emulating SC-55 capital tone fallback");
BIND_NUM_MIDI(midi_gain, 100, 0, 100,
"Fine tune native MIDI output level (default 100%)");
BIND_NUM_MIDI(midi_gain, 0, -20, 0, "Native MIDI gain [dB]");
}

music_module_t music_mid_module =
Expand All @@ -1512,4 +1519,5 @@ music_module_t music_mid_module =
I_MID_UnRegisterSong,
I_MID_DeviceList,
I_MID_BindVariables,
I_MID_MidiPlayerType,
};
4 changes: 4 additions & 0 deletions src/i_oalcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "al.h"
#include "alc.h"

#include <math.h>

#include "doomtype.h"

// C doesn't allow casting between function and non-function pointer types, so
Expand All @@ -36,6 +38,8 @@

#define ALFUNC(T, ptr) (ptr = FUNCTION_CAST(T, alGetProcAddress(#ptr)))

#define DB_TO_GAIN(db) powf(10.0f, (db) / 20.0f)

typedef struct oal_system_s
{
ALCdevice *device;
Expand Down
3 changes: 0 additions & 3 deletions src/i_oalequalizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "alc.h"
#include "alext.h"

#include <math.h>

#include "i_oalcommon.h"
#include "i_oalequalizer.h"
#include "i_sound.h"
Expand Down Expand Up @@ -233,7 +231,6 @@ void I_OAL_SetEqualizer(void)
// Gains vary from 0.251 up to 3.981, which means from -12dB attenuation
// up to +12dB amplification, i.e. 20*log10(gain).

#define DB_TO_GAIN(db) powf(10.0f, (db) / 20.0f)
#define EQ_GAIN(db) ((ALfloat)BETWEEN(0.251f, 3.981f, DB_TO_GAIN(db)))
#define LP_GAIN(db) ((ALfloat)BETWEEN(0.063f, 1.0f, DB_TO_GAIN(db)))
#define OCTAVE(x) ((ALfloat)BETWEEN(0.01f, 1.0f, (x) / 100.0f))
Expand Down
27 changes: 21 additions & 6 deletions src/i_oalmusic.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <stdlib.h>

#include "doomtype.h"
#include "i_oalcommon.h"
#include "i_oalstream.h"
#include "i_printf.h"
#include "i_sound.h"
Expand Down Expand Up @@ -308,12 +309,12 @@ static void I_OAL_SetMusicVolume(int volume)

if (active_module == &stream_opl_module)
{
gain *= (ALfloat)opl_gain / 100.0f;
gain *= (ALfloat)DB_TO_GAIN(opl_gain);
}
#if defined(HAVE_FLUIDSYNTH)
else if (active_module == &stream_fl_module)
{
gain *= (ALfloat)mus_gain / 100.0f;
gain *= (ALfloat)DB_TO_GAIN(mus_gain);
}
#endif

Expand Down Expand Up @@ -458,13 +459,26 @@ static const char **I_OAL_DeviceList(void)
return devices;
}

static midiplayertype_t I_OAL_MidiPlayerType(void)
{
#ifdef HAVE_FLUIDSYNTH
if (active_module == &stream_fl_module)
{
return midiplayer_fluidsynth;
}
#endif
if (active_module == &stream_opl_module)
{
return midiplayer_opl;
}
return midiplayer_none;
}

static void I_OAL_BindVariables(void)
{
BIND_NUM_MIDI(opl_gain, 200, 100, 1000,
"Fine tune OPL emulation output level (default 200%)");
BIND_NUM_MIDI(opl_gain, 0, -20, 20, "OPL emulation gain [dB]");
#if defined (HAVE_FLUIDSYNTH)
BIND_NUM_MIDI(mus_gain, 100, 10, 1000,
"Fine tune FluidSynth output level (default 100%)");
BIND_NUM_MIDI(mus_gain, 0, -20, 20, "FluidSynth gain [dB]");
#endif
for (int i = 0; i < arrlen(midi_modules); ++i)
{
Expand All @@ -485,4 +499,5 @@ music_module_t music_oal_module =
I_OAL_UnRegisterSong,
I_OAL_DeviceList,
I_OAL_BindVariables,
I_OAL_MidiPlayerType,
};
11 changes: 10 additions & 1 deletion src/i_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,15 @@ void I_SetSoundModule(void)
MN_UpdateAdvancedSoundItems(snd_module != SND_MODULE_3D);
}

midiplayertype_t I_MidiPlayerType(void)
{
if (active_module)
{
return active_module->I_MidiPlayerType();
}
return midiplayer_none;
}

void I_SetMidiPlayer(void)
{
if (nomusicparm)
Expand Down Expand Up @@ -745,6 +754,6 @@ void I_BindSoundVariables(void)
"MIDI Player string");
for (int i = 0; i < arrlen(music_modules); ++i)
{
music_modules[i]->BindVariables();
music_modules[i]->I_BindVariables();
}
}
13 changes: 12 additions & 1 deletion src/i_sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ int I_SoundID(int handle);
// MUSIC I/O
//

typedef enum
{
midiplayer_none,
midiplayer_native,
midiplayer_fluidsynth,
midiplayer_opl,
} midiplayertype_t;

midiplayertype_t I_MidiPlayerType(void);

typedef struct
{
boolean (*I_InitMusic)(int device);
Expand All @@ -155,7 +165,8 @@ typedef struct
void (*I_StopSong)(void *handle);
void (*I_UnRegisterSong)(void *handle);
const char **(*I_DeviceList)(void);
void (*BindVariables)(void);
void (*I_BindVariables)(void);
midiplayertype_t (*I_MidiPlayerType)(void);
} music_module_t;

extern music_module_t music_oal_module;
Expand Down
1 change: 1 addition & 0 deletions src/mn_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ typedef struct setup_menu_s
mrect_t rect;
int lines; // number of lines for rect, always > 0
const char *desc; // overrides default description
const char *append; // string to append to value
} setup_menu_t;

// phares 4/21/98: Moved from m_misc.c so m_menu.c could see it.
Expand Down
22 changes: 22 additions & 0 deletions src/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,11 +1160,32 @@ boolean MN_StartsWithMapIdentifier(char *str)
return false;
}

static boolean GamepadSave(int choice)
{
if (menu_input == pad_mode)
{
// Immediately save game using a default name.
saveSlot = choice;
savegamestrings[choice][0] = 0;
SetDefaultSaveName(choice);
M_DoSave(choice);
LoadDef.lastOn = choice;
return true;
}

return false;
}

//
// User wants to save. Start string input for M_Responder
//
static void M_SaveSelect(int choice)
{
if (GamepadSave(choice))
{
return;
}

// we are going to be intercepting all chars
saveStringEnter = 1;

Expand Down Expand Up @@ -2795,6 +2816,7 @@ boolean M_Responder(event_t *ev)
if ((demoplayback && (action == MENU_ENTER || action == MENU_BACKSPACE))
|| action == MENU_ESCAPE) // phares
{
I_ShowMouseCursor(menu_input != pad_mode);
MN_StartControlPanel();
M_StartSound(sfx_swtchn);
return true;
Expand Down
Loading

0 comments on commit a7c2a9d

Please sign in to comment.