Commit graph

2596 commits

Author SHA1 Message Date
Simon Howard
495694da29 opl: Add API to adjust tempo.
When the tempo is changed, the times on all active timers must be
adjusted to match the new timing values. Add an API to do this and
invoke it when a tempo change meta event is read.
2014-05-10 14:00:41 -04:00
Simon Howard
541267071a music: Allow / separators in substitute filenames.
For substitute music files we want to be able to specify relative
paths in a platform-independent way using Unix path separators.
Replace Unix-style / separators in the path that was read with the
path separator for the native system.
2014-05-08 22:27:18 -04:00
Simon Howard
e898c2f0de opl: Process MIDI 'set tempo' meta events.
The MIDI format includes a special meta event to set the tempo of
playback, and some WADs depend on this - notably the music in Alien
Vendetta. Move the variables controlling tempo to the global scope
(they are not per-track as I previously thought) and set when the
tempo events are encountered.

This is some progress towards resolving #334, but that bug is not
yet completely fixed, because the tempo change does not
retroactively apply to OPL timers that have already been set.
2014-05-08 00:44:50 -04:00
Simon Howard
b2e5952c45 oplmusic: Handle key-on with volume 0 as key-off.
Some MIDI files, such as the music tracks in AV.wad, use a second
"key on" event with a volume of zero to mean "key off". Handle this
case correctly.
2014-05-06 22:03:00 -04:00
Simon Howard
f102dc1c7d setup: Add Xbox360, Logitech joystick settings.
Recognise the Xbox360 controller and Logitech Dual Action controllers
and set defaults as appropriate. Thanks to Brad Harding for the
information about these controllers.
2014-05-05 22:16:55 -04:00
Simon Howard
7684ddcfd8 Clean up file headers.
This change rewrites and simplifies the copyright headers at the top
of all source files:

 * Remove "Emacs style mode select" line; this line was included in
   the headers for the originally released source files and appears
   to be to set the file type for old versions of Emacs. I'm not sure
   entirely why it was required but I don't think it is any more.
 * Remove "You should have received a copy of..." text from copyright
   header. This refers to the old 59 Temple Place address where the
   FSF headquarters used to be located and is no longer correct.
   Rather than change to the new address, just remove the paragraph
   as it is superfluous anyway. This fixes #311.
 * Remove ---- separator lines so that the file headers are barer
   and more simplified.
2014-05-05 00:20:54 -04:00
Simon Howard
869e52062b music: Tweak comment parsing for substitute configs.
Allow comments to be attached to the end of configuration lines, as
well as being specified on a line on their own.
2014-05-04 18:18:23 -04:00
Simon Howard
9ec075b024 setup: Add configuration for Wii remote.
The Wii remote is not a HID device, meaning it cannot be supported in
a proper cross-platform way. However, it can be supported for
individual platforms. Add a fingerprint and configuration for a Wii
remote under OS X using the WJoy tool.
2014-05-03 23:19:41 -04:00
Simon Howard
f56a8ac302 setup: Fix disabling of joystick button bindings.
When setting a joystick button binding to -1 to disable it, set it
directly; do not go through to the physical button mapping layer.

Also add a quick note to encourage users to send in details of their
gamepads.
2014-05-03 23:18:21 -04:00
Simon Howard
930eae1c24 setup: Start a list of known gamepads.
Detect certain gamepads by name and automatically configure defaults
for buttons and axes, to minimize setup time. Supported so far are
the PS3 controller and AIRFLO gamepad.
2014-05-03 22:51:09 -04:00
Simon Howard
0cd8f2e5fd Merge pull request #393 from chungy/master
setup: fix usejoystick/use_joystick typo in the previous commit
2014-05-01 18:08:52 -04:00
Mike Swanson
f14065d0dc setup: fix usejoystick/use_joystick typo in the previous commit 2014-05-01 14:01:31 -07:00
Simon Howard
10b94b8e2d setup: Enable joystick after calibration.
If the user has just successfully calibrated the joystick, then
turn on use_joystick as a convenience feature.
2014-05-01 01:55:21 -04:00
Simon Howard
ca2a6aee59 opl: Fix crash when using OPL music.
The previous change to add the poll method to the music module
interface introduced a crash, as the OPL music struct does not
define a poll method.
2014-05-01 01:54:23 -04:00
Simon Howard
f1a5a3b999 setup: Add control for joystick menu button.
The code is already in place for this but there was no control in
the setup tool to configure it.
2014-05-01 00:46:06 -04:00
Simon Howard
e98efaf118 config: Clarify config file documentation.
Re-word some of the documentation for the joystick button config
variables, to avoid confusion between physical/virtual joystick
buttons.
2014-05-01 00:38:06 -04:00
Simon Howard
05f22d03aa setup: Configure joystick buttons with virtual mapping.
Refactor how joystick buttons are reassigned. Define a fixed
mapping from joyb* variables to virtual buttons, and change the
button assignments at the virtual->physical mapping level.
2014-05-01 00:19:51 -04:00
Simon Howard
4890591ba5 joystick: Add virtual-physical button mapping.
The solution to solving #386 is to add a layer of indirection: the
game code can only support up to ~20 joystick buttons, but this
doesn't matter as long as we never want to bind more than 20 buttons
to actions anyway. Redefine the game's notion of buttons to be based
on "virtual" joystick buttons, and map these buttons to physical
(SDL) buttons based on configuration file variables.
2014-04-30 22:56:04 -04:00
Simon Howard
96ff3f7bc1 system: Refactor error dialog box.
When showing error message via Zenity, show the expanded (sprintf'ed)
error, not the format string. Refactor the sprintf part to be part of
the common code to avoid duplication.
2014-04-30 21:33:43 -04:00
Simon Howard
ea90460a26 joystick: Mask out bits for button axis buttons.
When a "button" is actually used as part of a button axis, don't
include presses on the button as part of the buttons field posted
in joystick events. This avoids situations where button 1 or 2
are part of a D-pad, breaking menu navigation (related to #389).
2014-04-30 01:00:28 -04:00
Simon Howard
3bc4cfcf87 strife: Fix joystick jump button.
The code to handle the joystick jump button variable was not
implemented. Check the jump button on the joystick as well as the
keyboard and mouse button equivalents when deciding whether to set
the jump bit.
2014-04-30 00:58:23 -04:00
Simon Howard
eebddb1fff system: Escape special characters for Zenity.
When invoking Zenity to display an error message, some characters can
have special meanings to the shell. Escape these properly so that the
error message is always shown correctly.

This fixes #355.
2014-04-30 00:24:38 -04:00
Simon Howard
12bac584e1 Merge branch 'master' of github.com:chocolate-doom/chocolate-doom 2014-04-30 00:07:14 -04:00
Simon Howard
da2fa989eb Merge pull request #388 from willybarro/355_show_error_messagebox_on_linux
Add native notification box for errors on linux.
2014-04-30 00:07:06 -04:00
Simon Howard
8659cfd640 setup: Detect and ignore bad joystick axes.
In some cases a joystick axis can be "stuck" and have a large
uncentered value. These must be detected and ignored, otherwise the
axis can be chosen during calibration instead of the user's actual
desired axis.
2014-04-29 23:45:29 -04:00
Willy Barro
4d41e7e74d Add native notification box for errors on linux.
Errors will now be shown as a message box, instead of
only a console message. This fixes the user not seeing
error messages, like if the IWAD is not provided.

- Add zenity notification box call on I_Error
2014-04-29 19:23:08 -03:00
Simon Howard
242fa1ee46 textscreen: Fix jump when clicking on scrollbars.
Clicking on a scrollbar should scroll the cursor to that location, but
the logic for it was buggy because of loss of precision when doing an
integer divide. When dividing by bar_max, seek up to the nearest value
so that the cursor always arrives where we clicked.

Thanks to Alexandre-Xavier for reporting this bug. This fixes #359.
2014-04-29 01:47:13 -04:00
Simon Howard
db9aee2beb setup: Allow backspace or del to clear controls.
Backspace or delete clears other input boxes; make it do the same for
keyboard, mouse and joystick inputs.
2014-04-29 01:09:07 -04:00
Simon Howard
3a0370f276 hexen: Fix joystick strafe left/right buttons.
Hexen was missing the code to handle the strafe left/right buttons.
2014-04-29 00:56:45 -04:00
Simon Howard
6d48ceda65 setup: Detect and configure hat-based D-pads.
As a second fallback, if all joysticks are centered and no buttons
are pressed, look at the hats on the joystick to see if one of those
is uncentered. Bizarre as it seems, some gamepads actually present the
D-pad as a hat.
2014-04-28 22:03:54 -04:00
Simon Howard
15c0779ec8 joystick: Add "hat axis" support.
Just as some controllers have D-pads that are presented as a set of
buttons, some other controllers actually present their D-pads as
joystick hats. Add "hat axis" support where the hat number and
axis can be packed into a single integer value.
2014-04-28 21:52:24 -04:00
Simon Howard
4d547c0361 joystick: Increase 'dead zone' size.
The joystick dead zone is the range within which the joystick is
interpreted as being centered. Increase this range significantly, as
some controllers (eg. the PS2 controller + USB connector) can be very
sensitive, leading to the player spinning randomly even when the stick
is centered.
2014-04-28 21:33:21 -04:00
Simon Howard
ba5470ce74 setup: Add support for button axis calibration.
Detect when we need to configure a "button axis" by falling back to
buttons when none of the joystick axes are significantly outside of
the centered range. Add extra calibration stages to get the D-pad
buttons for right and down in these cases.
2014-04-28 21:06:23 -04:00
Simon Howard
a9be9d879a joystick: Add support for "button axes".
Some gamepads, notably the PS3 SIXAXIS controller, provide the D-pad
not as a pair of axes, but rather as four separate buttons. Define a
special axis numbering scheme that packs two button numbers into a
single number, and allow an axis to be defined this way.
2014-04-28 20:22:08 -04:00
Simon Howard
797a9a563b music: Add loop point Ogg/Flac metadata support.
ZDoom has defined a format for Vorbis metadata comments named
LOOP_START and LOOP_END that allow the start and end points to be
defined in .ogg and .flac files for looping music. Add support for
these (they are used in Brandon Blume's SC-55 recordings).
2014-04-27 00:58:59 -04:00
Simon Howard
90f7206384 Merge branch 'master' of github.com:chocolate-doom/chocolate-doom 2014-04-26 21:17:53 -04:00
Simon Howard
3aefe2f23c osx: Handle .hhe, .seh file extensions.
These are the equivalents of .deh for Heretic and Strife. Add these as
file associations and auto-switch to the appropriate game type when
opened.
2014-04-26 21:15:08 -04:00
Fabian Greffrath
71936d1848 Fix a segfault in i_sdlmusic.c
We are free()ing the const char* a few lines later.
2014-04-22 19:05:46 +02:00
Fabian Greffrath
9fcbb2be4e Follow up for "fix man/Makefile for forks" 2014-04-22 13:09:00 +02:00
Simon Howard
81b5839ab1 server: Fix sending of WAD/DEH checksums to clients.
Clients receive the WAD and dehacked checksums of the controlling
player and are supposed to display a warning at the startup screen if
they do not match. However, reversed logic in the code that sends the
waiting data to clients meant that they were always sent their own
checksums, so the error message was never displayed.

This fixes #384.
2014-04-19 15:04:13 -04:00
Simon Howard
7d238f6148 setup: Make iwad_t pointers const.
The table of IWAD data is stored in const memory, so make all iwad_t
pointers const to fix compiler warnings.
2014-04-19 03:39:55 -04:00
Simon Howard
48e9644315 Exit with error on startup if using the wrong IWAD.
Having multiple binaries can cause some confusion - some users try to
run chocolate-doom with hexen.wad, thinking it is supported. Add a
startup check that makes sure the user is not trying to start the game
using the wrong IWAD file for the binary being run.

This fixes #382.
2014-04-19 03:32:38 -04:00
Simon Howard
b86a383c6f setup: Change labelling to clarify gamepad support.
Vanilla Doom's setup.exe only made reference to "joysticks" as back
then gamepads were relatively uncommon for PCs and ports for game
controllers canonically known as "joystick ports". Nowadays it's far
more likely (and ergonomic) that the player will be using a gamepad
than a joystick. Change the labelling to refer to "Gamepad/Joystick"
or "controller" instead.
2014-04-19 01:46:06 -04:00
Simon Howard
f0b710024a joystick: Add joystick button to toggle menu.
When using a joystick or gamepad it's nice to be able to bring up the
menu without having to reach for the keyboard. This makes modern
gamepads more useful/usable.
2014-04-19 01:35:40 -04:00
Simon Howard
74e1b8b754 joystick: Add an axis to allow strafing.
Modern gamepads typically have 2-3 D-pads and joysticks. This means
that it's desirable to be able to use one joystick for turning and
another for strafing. Add another axis in addition to the current X
and y axes that performs strafe movement.
2014-04-19 01:12:13 -04:00
Simon Howard
64cdaabd29 Merge branch 'master' of github.com:chocolate-doom/chocolate-doom 2014-04-17 02:23:33 -04:00
Simon Howard
e38b186c31 Add first version of philosophy document. 2014-04-17 02:22:42 -04:00
Simon Howard
c2caed900d setup: Call TXT_Shutdown on exit.
Some systems (fbcon SDL driver) get messed up if not cleanly shut
down. Make sure that we call SDL_QuitSubsystem on shutdown.
2014-04-13 23:34:21 +00:00
Simon Howard
50742cfc92 music: Fix -dumpsubstconfig for Heretic/Hexen.
The config dumping command line option assumed that music lumps were
named like D_MYLUMP, but this is not the case for Heretic and Hexen,
where there is no D_ prefix and music lumps can have any name.

Change the logic to instead look at the contents of lumps and identify
music lumps from the MUS / MIDI header.
2014-04-12 21:02:41 -04:00
Simon Howard
d70c830b4d video: Change default for screen_bpp to 0.
Some machines don't work well with 8-bit screen depths any more. It's
better to default to just using the machine's native color depth
instead. Change the default to 0 (for SDL_SetVideoMode this means "use
native color depth"), auto-adjust to native color depth on startup if
screen_bpp=0 (so that debug messages at least make sense) and document
for the config file value that a value of zero means "use native".
2014-04-12 17:14:37 -04:00