diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 324a753ad..1e532a1da 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -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 @@ -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 @@ -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 @@ -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 }} diff --git a/src/g_game.c b/src/g_game.c index 3e3354092..a89bd00a1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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; } @@ -953,6 +954,7 @@ void G_ClearInput(void) I_ResetRelativeMouseState(); I_ResetAllRumbleChannels(); WS_Reset(); + activate_death_use_reload = false; } // diff --git a/src/i_midimusic.c b/src/i_midimusic.c index 49c97be8a..629edb990 100644 --- a/src/i_midimusic.c +++ b/src/i_midimusic.c @@ -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) @@ -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, @@ -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 = @@ -1512,4 +1519,5 @@ music_module_t music_mid_module = I_MID_UnRegisterSong, I_MID_DeviceList, I_MID_BindVariables, + I_MID_MidiPlayerType, }; diff --git a/src/i_oalcommon.h b/src/i_oalcommon.h index 7fec5e9c3..581ff0ef6 100644 --- a/src/i_oalcommon.h +++ b/src/i_oalcommon.h @@ -22,6 +22,8 @@ #include "al.h" #include "alc.h" +#include + #include "doomtype.h" // C doesn't allow casting between function and non-function pointer types, so @@ -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; diff --git a/src/i_oalequalizer.c b/src/i_oalequalizer.c index 4a9870608..455778725 100644 --- a/src/i_oalequalizer.c +++ b/src/i_oalequalizer.c @@ -20,8 +20,6 @@ #include "alc.h" #include "alext.h" -#include - #include "i_oalcommon.h" #include "i_oalequalizer.h" #include "i_sound.h" @@ -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)) diff --git a/src/i_oalmusic.c b/src/i_oalmusic.c index d9a285ca9..1c848c24a 100644 --- a/src/i_oalmusic.c +++ b/src/i_oalmusic.c @@ -22,6 +22,7 @@ #include #include "doomtype.h" +#include "i_oalcommon.h" #include "i_oalstream.h" #include "i_printf.h" #include "i_sound.h" @@ -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 @@ -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) { @@ -485,4 +499,5 @@ music_module_t music_oal_module = I_OAL_UnRegisterSong, I_OAL_DeviceList, I_OAL_BindVariables, + I_OAL_MidiPlayerType, }; diff --git a/src/i_sound.c b/src/i_sound.c index 162f6d539..b99359a97 100644 --- a/src/i_sound.c +++ b/src/i_sound.c @@ -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) @@ -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(); } } diff --git a/src/i_sound.h b/src/i_sound.h index 9a36e633c..49e92b7f8 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -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); @@ -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; diff --git a/src/mn_internal.h b/src/mn_internal.h index b7a3723dd..fa411d32a 100644 --- a/src/mn_internal.h +++ b/src/mn_internal.h @@ -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. diff --git a/src/mn_menu.c b/src/mn_menu.c index 6dead45fd..9fec50cb9 100644 --- a/src/mn_menu.c +++ b/src/mn_menu.c @@ -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; @@ -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; diff --git a/src/mn_setup.c b/src/mn_setup.c index e3ea68fe7..d3f73cdec 100644 --- a/src/mn_setup.c +++ b/src/mn_setup.c @@ -824,6 +824,11 @@ static void DrawSetting(setup_menu_t *s, int accum_y) M_snprintf(menu_buffer, sizeof(menu_buffer), "%d%%", s->var.def->location->i); } + else if (s->append) + { + M_snprintf(menu_buffer, sizeof(menu_buffer), "%d %s", + s->var.def->location->i, s->append); + } else { M_snprintf(menu_buffer, sizeof(menu_buffer), "%d", @@ -991,6 +996,11 @@ static void DrawSetting(setup_menu_t *s, int accum_y) { M_snprintf(menu_buffer, sizeof(menu_buffer), "%d%%", value); } + else if (s->append) + { + M_snprintf(menu_buffer, sizeof(menu_buffer), "%d %s", value, + s->append); + } else { M_snprintf(menu_buffer, sizeof(menu_buffer), "%d", value); @@ -2449,6 +2459,30 @@ static void SetMidiPlayer(void) S_RestartMusic(); } +static void SetMidiPlayerNative(void) +{ + if (I_MidiPlayerType() == midiplayer_native) + { + SetMidiPlayer(); + } +} + +static void SetMidiPlayerOpl(void) +{ + if (I_MidiPlayerType() == midiplayer_opl) + { + SetMidiPlayer(); + } +} + +static void SetMidiPlayerFluidSynth(void) +{ + if (I_MidiPlayerType() == midiplayer_fluidsynth) + { + SetMidiPlayer(); + } +} + static void MN_Midi(void); static void MN_Equalizer(void); @@ -2509,43 +2543,43 @@ static const char *midi_reset_type_strings[] = { static setup_menu_t midi_settings1[] = { - {"Native MIDI Gain", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC, - {"midi_gain"}, .action = UpdateMusicVolume}, + {"Native MIDI Gain", S_THERMO, CNTR_X, M_THRM_SPC, + {"midi_gain"}, .action = UpdateMusicVolume, .append = "dB"}, {"Native MIDI Reset", S_CHOICE | S_ACTION, CNTR_X, M_SPC, {"midi_reset_type"}, .strings_id = str_midi_reset_type, - .action = SetMidiPlayer}, + .action = SetMidiPlayerNative}, {"Compatibility Level", S_CHOICE | S_ACTION, CNTR_X, M_SPC, {"midi_complevel"}, .strings_id = str_midi_complevel, - .action = SetMidiPlayer}, + .action = SetMidiPlayerNative}, {"SC-55 CTF Emulation", S_ONOFF, CNTR_X, M_SPC, {"midi_ctf"}, - .action = SetMidiPlayer}, + .action = SetMidiPlayerNative}, MI_GAP, #if defined (HAVE_FLUIDSYNTH) - {"FluidSynth Gain", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC, {"mus_gain"}, - .action = UpdateMusicVolume}, + {"FluidSynth Gain", S_THERMO, CNTR_X, M_THRM_SPC, {"mus_gain"}, + .action = UpdateMusicVolume, .append = "dB"}, {"FluidSynth Reverb", S_ONOFF, CNTR_X, M_SPC, {"mus_reverb"}, - .action = SetMidiPlayer}, + .action = SetMidiPlayerFluidSynth}, {"FluidSynth Chorus", S_ONOFF, CNTR_X, M_SPC, {"mus_chorus"}, - .action = SetMidiPlayer}, + .action = SetMidiPlayerFluidSynth}, MI_GAP, #endif - {"OPL3 Gain", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC, {"opl_gain"}, - .action = UpdateMusicVolume}, + {"OPL3 Gain", S_THERMO, CNTR_X, M_THRM_SPC, {"opl_gain"}, + .action = UpdateMusicVolume, .append = "dB"}, {"OPL3 Number of Chips", S_THERMO | S_THRM_SIZE4 | S_ACTION, CNTR_X, - M_THRM_SPC, {"num_opl_chips"}, .action = SetMidiPlayer}, + M_THRM_SPC, {"num_opl_chips"}, .action = SetMidiPlayerOpl}, {"OPL3 Reverse Stereo", S_ONOFF, CNTR_X, M_SPC, - {"opl_stereo_correct"}, .action = SetMidiPlayer}, + {"opl_stereo_correct"}, .action = SetMidiPlayerOpl}, MI_END }; @@ -2580,45 +2614,42 @@ static const char *equalizer_preset_strings[] = { "Off", "Classical", "Rock", "Vocal", "Custom" }; -#define M_THRM_SPC_EQ (M_THRM_HEIGHT - 1) -#define M_SPC_EQ 8 - static setup_menu_t eq_settings1[] = { - {"Preset", S_CHOICE, CNTR_X, M_SPC_EQ, {"snd_equalizer"}, + {"Preset", S_CHOICE, CNTR_X, M_SPC, {"snd_equalizer"}, .strings_id = str_equalizer_preset, .action = I_OAL_EqualizerPreset}, MI_GAP_EX(4), - {"Preamp dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_preamp"}, .action = I_OAL_EqualizerPreset}, + {"Preamp", S_THERMO, CNTR_X, M_THRM_SPC, + {"snd_eq_preamp"}, .action = I_OAL_EqualizerPreset, .append = "dB"}, MI_GAP_EX(4), - {"Low Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_low_gain"}, .action = I_OAL_EqualizerPreset}, + {"Low Gain", S_THERMO, CNTR_X, M_THRM_SPC, + {"snd_eq_low_gain"}, .action = I_OAL_EqualizerPreset, .append = "dB"}, - {"Mid 1 Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_mid1_gain"}, .action = I_OAL_EqualizerPreset}, + {"Mid 1 Gain", S_THERMO, CNTR_X, M_THRM_SPC, + {"snd_eq_mid1_gain"}, .action = I_OAL_EqualizerPreset, .append = "dB"}, - {"Mid 2 Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_mid2_gain"}, .action = I_OAL_EqualizerPreset}, + {"Mid 2 Gain", S_THERMO, CNTR_X, M_THRM_SPC, + {"snd_eq_mid2_gain"}, .action = I_OAL_EqualizerPreset, .append = "dB"}, - {"High Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_high_gain"}, .action = I_OAL_EqualizerPreset}, + {"High Gain", S_THERMO, CNTR_X, M_THRM_SPC, + {"snd_eq_high_gain"}, .action = I_OAL_EqualizerPreset, .append = "dB"}, MI_GAP_EX(4), - {"Low Cutoff Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_low_cutoff"}, .action = I_OAL_EqualizerPreset}, + {"Low Cutoff", S_NUM, CNTR_X, M_SPC, + {"snd_eq_low_cutoff"}, .action = I_OAL_EqualizerPreset, .append = "Hz"}, - {"Mid 1 Center Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_mid1_center"}, .action = I_OAL_EqualizerPreset}, + {"Mid 1 Center", S_NUM, CNTR_X, M_SPC, + {"snd_eq_mid1_center"}, .action = I_OAL_EqualizerPreset, .append = "Hz"}, - {"Mid 2 Center Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_mid2_center"}, .action = I_OAL_EqualizerPreset}, + {"Mid 2 Center", S_NUM, CNTR_X, M_SPC, + {"snd_eq_mid2_center"}, .action = I_OAL_EqualizerPreset, .append = "Hz"}, - {"High Cutoff Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ, - {"snd_eq_high_cutoff"}, .action = I_OAL_EqualizerPreset}, + {"High Cutoff", S_NUM, CNTR_X, M_SPC, + {"snd_eq_high_cutoff"}, .action = I_OAL_EqualizerPreset, .append = "Hz"}, MI_END }; @@ -3931,36 +3962,36 @@ static boolean ChangeEntry(menu_action_t action, int ch) { if (gather_count) // Any input? { - int value; - gather_buffer[gather_count] = 0; - value = atoi(gather_buffer); // Integer value - if ((def->limit.min != UL && value < def->limit.min) - || (def->limit.max != UL && value > def->limit.max)) + int value = atoi(gather_buffer); // Integer value + + int min = def->limit.min; + int max = def->limit.max; + + if ((min != UL && value < min) || (max != UL && value > max)) { warn_about_changes(S_BADVAL); + value = BETWEEN(min, max, value); } - else - { - def->location->i = value; - // killough 8/9/98: fix numeric vars - // killough 8/15/98: add warning message + def->location->i = value; - if (flags & (S_LEVWARN | S_PRGWARN)) - { - warn_about_changes(flags); - } - else if (def->current) - { - def->current->i = value; - } + // killough 8/9/98: fix numeric vars + // killough 8/15/98: add warning message - if (current_item->action) // killough 10/98 - { - current_item->action(); - } + if (flags & (S_LEVWARN | S_PRGWARN)) + { + warn_about_changes(flags); + } + else if (def->current) + { + def->current->i = value; + } + + if (current_item->action) // killough 10/98 + { + current_item->action(); } } SelectDone(current_item); // phares 4/17/98 diff --git a/src/p_enemy.c b/src/p_enemy.c index c04e66c4a..428fd029e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3270,6 +3270,7 @@ void A_JumpIfFlagsSet(mobj_t* actor) void A_AddFlags(mobj_t* actor) { unsigned int flags, flags2; + boolean update_blockmap; if (!mbf21 || !actor) return; @@ -3277,8 +3278,19 @@ void A_AddFlags(mobj_t* actor) flags = actor->state->args[0]; flags2 = actor->state->args[1]; + // unlink/relink the thing from the blockmap if + // the NOBLOCKMAP or NOSECTOR flags are added + update_blockmap = ((flags & MF_NOBLOCKMAP) && !(actor->flags & MF_NOBLOCKMAP)) + || ((flags & MF_NOSECTOR) && !(actor->flags & MF_NOSECTOR)); + + if (update_blockmap) + P_UnsetThingPosition(actor); + actor->flags |= flags; actor->flags2 |= flags2; + + if (update_blockmap) + P_SetThingPosition(actor); } // @@ -3290,6 +3302,7 @@ void A_AddFlags(mobj_t* actor) void A_RemoveFlags(mobj_t* actor) { unsigned int flags, flags2; + boolean update_blockmap; if (!mbf21 || !actor) return; @@ -3297,8 +3310,19 @@ void A_RemoveFlags(mobj_t* actor) flags = actor->state->args[0]; flags2 = actor->state->args[1]; + // unlink/relink the thing from the blockmap if + // the NOBLOCKMAP or NOSECTOR flags are removed + update_blockmap = ((flags & MF_NOBLOCKMAP) && (actor->flags & MF_NOBLOCKMAP)) + || ((flags & MF_NOSECTOR) && (actor->flags & MF_NOSECTOR)); + + if (update_blockmap) + P_UnsetThingPosition(actor); + actor->flags &= ~flags; actor->flags2 &= ~flags2; + + if (update_blockmap) + P_SetThingPosition(actor); } //---------------------------------------------------------------------------- diff --git a/src/p_user.c b/src/p_user.c index ad99a6d41..d26612384 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -320,8 +320,6 @@ void P_DeathThink (player_t* player) if (activate_death_use_reload) { - activate_death_use_reload = false; - if (savegameslot >= 0) { char *file = G_SaveGameName(savegameslot);