Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old March 23, 2016, 15:44   #1
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
RFC: Reworking sound sub-system

Now that my character is dead, I can get back to coding

I'm not sure if anyone is the designated 'maintainer' of the messaging sub-systems, so I thought I should run this be the dev team to make sure I'm not treading on any toes...

I've been looking at the interaction between the 'sound' and 'message' code and I think I can see a way to clean up the code somewhat - in particular the use of #include "list-message.h" into a static array no less than three times in message.c

I think there is some scope to make 'sound' a much cleaner hook into the 'message' sub-system

Let's look first at the message queue:

Code:
typedef struct _msgqueue_t
{
	message_t *head;
	message_t *tail;
	msgcolor_t *colors;
	u32b count;
	u32b max;
} msgqueue_t;
We have linked list of message texts and linked list of message colours...

I propose:

1. Moving the colours out of here and create a new array (of size MSG_MAX) of structures that contain the colour and sound definitions
2. Reformat sound.cfg to be like messages.prf - something like:
Code:
sound:DISSARM:plm_bang_ceramic plm_chest_latch plm_click_switch3
3. Ditch the second column in list-message.h (it's only used to map the names used in sound.cfg anyway)
4. Get rid of message_lookup_by_sound_name() and message_sound_name() (no longer needed as they are used to map the current sound.cfg names to MSG_ numbers)
5. Replace calls to sound() with calls to msgt(), so
Code:
sound(MSG_MULTIPLY);
becomes
Code:
msgt(MSG_MULTIPLY, "");
6. Convert many (if not all) calls to msg() to msgt() - Take, for example:
Code:
msg("You feel stronger!");
If we want to assign a sound to this one day, we'll need to either convert it then, or add the horribly hacky call to sound(). Why not just have
Code:
msgt(MSG_STAT_GAIN, "You feel stronger!");
Now to the discussions about mp3, ogg, wav, etc...

Notice that I removed the file extension from sound.cfg (I think we can safely assume a rename to sound.cfg is in order btw). We can leave it up to each individual platform to support whatever format they can (possibly even multiple formats if we like).

This brings me to the final part of the cleanup (and I've mentioned this in a previous post) - moving the processing of sound.prf into a single location with hooks that each platform sets for the initialisation, loading, playing, and unloading of sounds

EDIT: We could just move the sound file names into message.prf

Code:
message:<message-type>:<color>:<sound file> <sound file> ... <sound file>
calris is offline   Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reworking the entire magic system (yay)! TricksterWolf Development 8 September 20, 2015 21:22
Mk build system? CJNyfalt Development 11 March 25, 2015 08:25
Resist system Jungle_Boy Development 65 August 30, 2011 04:10
Combat System Sirridan Development 9 July 14, 2009 08:11
RFC: Middle Earth map for Un in ASCII; is it readable? Bandobras Variants 13 November 25, 2007 04:15


All times are GMT +1. The time now is 03:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.