Commit Graph

174 Commits

Author SHA1 Message Date
Charles Pigott 52ed3bcbaa Remove: A few bits of dead code 2018-10-31 12:41:49 +01:00
Niels Martin Hansen 336d6cab68 Fix 6298b96: Playlist window not drawing playlist
Copy-paste error in change to remove C++11 usage...
2018-06-25 00:00:56 +02:00
Niels Martin Hansen 6298b96571 Change: Modernise music control logic implementation (#6839)
Rewrite of almost the entire music control logic to a more modern style, hopefully also easier to understand. The old playlist handling made it look like arcane magic, which it doesn't have to be.

- Playlists are now stored in std::vector of objects instead of arrays of bytes with magic sentinel values, that need to be rotated around all the time. Position in playlist is stored as a simple index.
- The theme song is now reserved for the title screen, it doesn't play on any of the standard playlists, but is still available for use on custom playlists.
- When the player enters/leaves the game from the main menu, the music always restarts.
- Playback state (playing or not) is kept even if music becomes unavailable due to an empty playlist (or an empty music set), so it can restart immediately if music becomes available again.
- The shuffle algorithm was changed to a standard Fisher-Yates.
- Possibly better behavior when editing a custom playlist while it's playing.
- Custom playlists should be compatible.
- Framework for supporting custom playlists with songs from multiple music sets.
2018-06-24 20:06:05 +02:00
Niels Martin Hansen a1b7812c7e Change: Improved looping of title song 2018-06-15 23:09:17 +02:00
Niels Martin Hansen f946b3da56 Codechange: Pass a MusicSongInfo struct instead of bare filename to music drivers.
Preparation for later extending the info passed to music drivers.
2018-06-05 22:58:35 +02:00
Niels Martin Hansen 19f5a6cbb0 Feature #6090: Change music set during gameplay 2018-04-29 19:26:05 +02:00
Niels Martin Hansen 430e20f7e4 Fix: Clipping issues with volume sliders in Music GUI
Tested with various languages and GUI font sizes, should look good everywhere.

Also clamps near-end values to minimum and maximum so 0 and 127 are possible to achieve even on small GUI sizes (like the default.)
2018-04-29 19:26:05 +02:00
Niels Martin Hansen bb809e35ce Change: Less intrusive "no music" message from Music window 2018-04-29 19:26:05 +02:00
Niels Martin Hansen e172794947 Change: Disable music control buttons when there is no music 2018-04-29 19:26:05 +02:00
Niels Martin Hansen 76cccc64c9 Codechange: Music GUI comments and function naming 2018-04-29 19:26:05 +02:00
rubidium 771dcf3b7b (svn r27003) -Cleanup: fix the use of spaces and asterices "around" some comments 2014-10-12 18:41:53 +00:00
rubidium 4438821b80 (svn r26809) -Fix: do not dereference the -1 index of the file names array of music files. It definitely breaks on m68k, and might cause failures on other platforms as well 2014-09-10 16:33:42 +00:00
rubidium b476086c39 (svn r26538) -Codechange: remove double accounting of the drivers 2014-04-28 21:06:51 +00:00
rubidium 21f991e235 (svn r26489) -Codechange: properly account for the end of buffers in the file io code instead of assuming MAX_PATH is okay 2014-04-23 21:23:21 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
planetmaker 247feca247 (svn r25776) -Add [FS#5743]: Sticky and shade buttons for jukebox window (retro) 2013-09-15 15:56:46 +00:00
frosch 8157a8afd8 (svn r25290) -Add: Assign string names to notable windows. 2013-05-26 19:25:01 +00:00
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 2013-05-26 19:23:42 +00:00
frosch 03736af2ae (svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default. 2012-11-11 16:10:43 +00:00
truebrain e2d8abeec5 (svn r23544) -Codechange: document and rename widgets to be consistent and understandable 2011-12-16 18:02:27 +00:00
truebrain 2aa774e831 (svn r23528) -Codechange: move widget enums to widgets/NNN_type.h 2011-12-15 22:22:55 +00:00
rubidium 58423b26d1 (svn r23474) -Codechange: move the declaration error related functions to error.h 2011-12-10 13:54:10 +00:00
glx 634796b860 (svn r23430) -Fix (r23219): also consider the old directories when playing a song 2011-12-04 14:17:51 +00:00
rubidium 2b897b4fa0 (svn r23219) -Change: different directories for basesets and newgrfs. So data to baseset or newgrf, and gm to baseset 2011-11-14 21:34:27 +00:00
rubidium 99ed5eb7c5 (svn r23035) -Fix (r23034): compile failure 2011-10-16 19:59:07 +00:00
rubidium 0656660f22 (svn r23034) -Fix: make sure the custom playlists are 0 terminated 2011-10-16 19:56:47 +00:00
rubidium f04746a9ff (svn r23033) -Fix [FS#4776]: the last custom playlist items went lost when the files in the .obm are not contiguous 2011-10-16 19:53:02 +00:00
planetmaker ba7611ed13 (svn r22694) -Cleanup [FS#4579]: Remove unused but confusing widget 2011-07-30 07:38:38 +00:00
frosch 5e449b8fae (svn r22429) -Add: some constants for specific palette colours used in the GUI. 2011-05-06 21:13:29 +00:00
frosch 22286bd7b6 (svn r22421) -Fix: Replace various references to Windows palette greyscale indices with the DOS palette indices. 2011-05-04 17:45:16 +00:00
frosch ec9540a12a (svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData(). 2011-03-13 21:31:29 +00:00
rubidium f90044d343 (svn r22202) -Codechange: make MusicFileSettings a proper citizen of the client settings 2011-03-05 18:00:48 +00:00
rubidium ad15cd37a6 (svn r21698) -Fix: incorrectly named global variable 2011-01-02 18:12:39 +00:00
alberth f5c6fd1a25 (svn r21331) -Codechange: Make drawing the widgets default behaviour in OnPaint(). 2010-11-26 15:22:18 +00:00
rubidium 30637a8340 (svn r21157) -Codechange: remove information about the text direction out of the language "list" 2010-11-13 09:56:25 +00:00
yexo 241d705406 (svn r20474) -Cleanup: remove some unused code 2010-08-12 21:36:43 +00:00
rubidium e356cb9405 (svn r20281) -Codechange: unify case scope closure + break coding style 2010-08-01 18:53:30 +00:00
alberth 3a1451644a (svn r20221) -Codechange: Move unscrolled row calculation into a function. 2010-07-26 13:02:28 +00:00
alberth 22b9bc5157 (svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine(). 2010-07-02 13:53:05 +00:00
smatz f051066bc4 (svn r19224) -Codechange: change parameters passed to ShowErrorMessage() a bit 2010-02-24 14:46:15 +00:00
frosch 88019e64e1 (svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick(). 2010-01-30 18:34:48 +00:00
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 2010-01-15 16:41:15 +00:00
rubidium a8d6d18b22 (svn r18608) -Change: add the concept of music sets 2009-12-22 21:40:29 +00:00
rubidium ade9773080 (svn r18603) -Codechange: move getting the song name to music_gui.cpp 2009-12-22 18:34:07 +00:00
rubidium 250c355508 (svn r18369) -Fix [FS#3339] (rbeginning): off-by-one in the preconfigured music lists 2009-12-02 08:55:53 +00:00
rubidium 1f0da3710f (svn r18324) -Codechange: there's no need for a default size when the window isn't resizable 2009-11-28 15:01:49 +00:00
rubidium 293dfd7c3e (svn r18322) -Codechange: remove the WDP duplication; no need to tell the same twice. 2009-11-28 14:42:35 +00:00
rubidium ff32ea24fc (svn r18311) -Codechange: no need to hardcode locations of some 'random' windows 2009-11-28 13:38:34 +00:00
rubidium 8d6e323ef8 (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input 2009-11-24 21:13:36 +00:00
rubidium 14300d309c (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions 2009-11-24 18:05:55 +00:00
rubidium 69b6d9309a (svn r18274) -Codechange: remove the unused WDF flags 2009-11-24 17:28:29 +00:00
rubidium 5e247b6e43 (svn r18267) -Codechange: make the music window big font aware 2009-11-24 13:14:48 +00:00
alberth 450e40b997 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize(). 2009-11-22 18:28:14 +00:00
alberth 2b6f792513 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool. 2009-11-22 18:26:01 +00:00
rubidium 16f270467f (svn r18192) -Codechange: make the music window RTL aware 2009-11-19 20:34:45 +00:00
rubidium 8e201585e6 (svn r18182) -Codechange: use the zero fill control code instead of duplicating strings with 'only' the 0 differing 2009-11-19 13:56:10 +00:00
rubidium 5f2ddfbc5a (svn r18152) -Codechange: remove the 'minimum window size' from the WindowDesc; it's determined from the (nested) widgets 2009-11-17 19:16:48 +00:00
rubidium 3d2d7af88f (svn r18086) -Codechange: remove 'widget' from WindowDesc 2009-11-15 10:26:01 +00:00
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 2009-10-04 17:16:41 +00:00
alberth 116c77c342 (svn r17572) -Codechange: Use the Window::GetWidget() function to access nested widgets through the nested_array. 2009-09-19 11:31:12 +00:00
frosch ebd916be3d (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability. 2009-09-13 19:15:59 +00:00
yexo 070118c5c3 (svn r17381) -Codechange: music track selection window uses nested widgets 2009-09-02 14:09:51 +00:00
yexo e78da26f3c (svn r17361) -Fix (r17360): committed a bit too much 2009-09-01 21:35:28 +00:00
yexo f3d2be7581 (svn r17360) -Fix (r17329): the 'track' and 'title' texts were lost in the conversion to nested widgets 2009-09-01 21:30:14 +00:00
yexo b2fef7c64e (svn r17353) -Codechange: make sure the shuffle and programme buttons in the music window are always the same size 2009-09-01 19:18:42 +00:00
yexo 51806af03d (svn r17331) -Codechange: don't depend on static widget position/size for drawing of volumer sliders in music window 2009-08-30 21:31:54 +00:00
yexo 1f7fc96a78 (svn r17330) -Codechange: Lower some buttons in the music window when clicked instead of changing the text colour to white 2009-08-30 20:38:57 +00:00
yexo 6992d740f6 (svn r17329) -Codechange: music window uses nested widgets 2009-08-30 19:23:36 +00:00
rubidium aca7ba714a (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false 2009-08-23 19:03:09 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
rubidium 4b2592dbc0 (svn r17062) -Change: unify the naming of some 125 strings 2009-08-04 18:04:33 +00:00
rubidium 53887e07bb (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString. 2009-04-26 14:52:56 +00:00
rubidium 59d45a04d6 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible. 2009-04-21 23:40:56 +00:00
alberth ba200c6a92 (svn r16013) -Codechange: Add nested widgets to music windows. 2009-04-10 11:06:12 +00:00
alberth 9acb1dc3f2 (svn r16011) -Codechange: Extracting widget number enums from the window classes. 2009-04-10 11:02:09 +00:00
alberth 69ad98ecd5 (svn r16010) -Cleanup: Declare variables at first use. 2009-04-10 10:29:28 +00:00
alberth 0f360420fe (svn r16009) -Codechange: Simplifying some variable assignments. 2009-04-10 10:21:16 +00:00
alberth d28cd96817 (svn r16008) -Fix (r15808): Unswap swapped music selection panels. 2009-04-10 09:43:53 +00:00
rubidium 3e979be390 (svn r15846) -Fix: shuffle button text alignment was based on the wrong widget 2009-03-25 14:15:34 +00:00
rubidium 57174a9301 (svn r15808) -Codechange: use the new DrawString API in a number of GUIs 2009-03-22 12:01:21 +00:00
rubidium 9003641095 (svn r15790) -Codechange: remove the *Centered part of the old text drawing API. 2009-03-21 22:00:00 +00:00
rubidium f9def73be6 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth) 2009-03-15 15:12:06 +00:00
rubidium b25a4f8231 (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too 2009-03-15 00:32:18 +00:00
rubidium c0a8d09ca7 (svn r15428) -Codechange: consistently use colour instead of having both color and colour. 2009-02-09 02:57:15 +00:00
smatz 0d3f5e6e74 (svn r15299) -Cleanup: remove many redundant includes 2009-01-31 20:16:06 +00:00
rubidium 11da45ee55 (svn r14949) -Cleanup: pointer coding style 2009-01-10 00:31:47 +00:00
rubidium 6512d717e1 (svn r14811) -Fix: off-by-one causing possible out-of-bounds reads. 2009-01-03 17:10:20 +00:00
rubidium 099022224f (svn r14810) -Codechange: use the proper style for global variables. 2009-01-03 17:09:31 +00:00
frosch f2eba8b0bf (svn r14485) -Fix (r5464): Do not check the end of destination buffer using the source pointer.
Did not cause trouble though as destination buffer has always been bigger than source buffer.
2008-10-18 14:11:09 +00:00
frosch 63a9ddeb77 (svn r14484) -Fix (r10182) [FS#2358]: Obiwan dislikes music. (Patch by Yexo) 2008-10-18 13:43:52 +00:00
rubidium ea1f180a55 (svn r14199) -Codechange: split fileio.h into fileio_type.h and fileio_func.h so not everything that includes saveload.h needs to include everything else too. 2008-08-31 10:50:05 +00:00
belugas 5c3b347350 (svn r13895) -Codechange: Replace numbers with Colours enum on music gui and on DrawFrameRect calls
-Fix: a few misalignements
2008-07-31 14:42:55 +00:00
rubidium 27c38052b7 (svn r13185) -Codechange: remove everything related to the WindowProc callbacks. 2008-05-19 09:48:47 +00:00
glx c1713c9ab7 (svn r13150) -Codechange: make classes of the Music[TrackSelection]Window. 2008-05-17 22:52:51 +00:00
rubidium 8b54212900 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming. 2008-05-17 12:48:06 +00:00
rubidium f438700402 (svn r13024) -Codechange: do not use WE_MOUSELOOP when WE_TICK suffices, rename WE_4 to something more descriptive and correct some (completely incorrect) comments. 2008-05-09 09:29:27 +00:00
rubidium 23fc96c3e8 (svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window. 2008-05-08 11:50:34 +00:00
rubidium 9bf519f26b (svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL. 2008-05-06 22:08:18 +00:00
rubidium d03994098b (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description. 2008-05-06 15:11:33 +00:00
rubidium fde33b5547 (svn r12003) -Codechange: don't declare InteractiveRandom[Range] in multiple places. 2008-01-29 00:26:31 +00:00