While I was tracking down why the game always seemed to play the same song, it occurred to me that there is no way to access the music options from the Options drop down on the menu bar.  I thought It would be useful to be able to access the music options from the game, so I added it to the list of choices, just under “Sound”.

To do this, you must:

1) open keymap.h This file enumerates a type called KEY_FUNCTION.  We need to added Music as an enumerator in this type.  

	Line 74 reads:
[code]
KEY_FUNCTION_SOUND_OPTIONS,
[/code]

	add:
[code]
KEY_FUNCTION_SOUND_OPTIONS,
// MUSIC added by ahenobarb
KEY_FUNCTION_MUSIC_OPTIONS, 
[/code]

2) open keymap.cpp  This file is linked to keypress.cpp, which controls what function is executed when the item in the list is clicked. The name within the quotes is that name of the string (ommitting “str_ldl” – I don’t know why) in “ldl_str.txt” to print on the screen [see below].

	on line 54, add:
	[code]
// MUSIC added by ahenobarb
{ 0, KEY_FUNCTION_MUSIC_OPTIONS, "MUSIC_OPTIONS"},
	[/code]

3) open keypress.cpp This file tell CTP2 what functions to execute when a key is pressed.
	
	You need to include the header file for the musicsreen, so on line 90, add:
	[code]
// music added by ahenobarb
#include "musicscreen.h"
	[/code]

	musicscreen_displayMyWindow(); is the actual function that causes the music options screen to be displayed.  On line 1162, add:
[code]
// MUSIC added by ahenobarb
	case KEY_FUNCTION_MUSIC_OPTIONS:
		if(!g_modalWindow) {
			musicscreen_displayMyWindow();
		}
	break; 
[/code]

4) Open controlpanelwindow.cpp, which control the items listed in the drop down menu on the menubar.

	You need to include the header file for the musicsreen, so on line 37, add:
[code]
// music added by ahenobarb
#include "musicscreen.h"
[/code]

	You need to add music to the list of choices in the menu bar.  So in the OptionsMenuCallback function, we need to add “music” as a choice.  The switch statement for the “Options” menu begins on line 858.  On line 915, add:
[code]
	case	CP_MENU_ITEM_12:	
		musicscreen_displayMyWindow(); 
		break;
[/code]  
**** It is not clear whether the function call to “musicscreen_displayMyWindow();” in keypress.cpp or controlpanelwindow.cpp actually calls the music options screen ***

	Further down in the file on line 1063 is a ControlPanelWindow class member named RebuildMenus.  The purpose of this function is to print the list items here on the screen, so the user can select them.  This class member however is not used in the Debug build of the game, but it may be used in other builds.  Therefore, you should add music to the list just in case.  On line 1146, add:
[code]
// MUSIC added by ahenobarb
mb->AddMenuItem(menu,(char*)g_theStringDB->GetNameStr("str_ldl_Music"),
		KeyListItem::GetKeyFromKMScreen(theKeyMap->get_keycode(KEY_FUNCTION_MUSIC_OPTIONS)),(void *)CP_MENU_ITEM_12); [/code]

On line 1355 is a ControlPanelWindow class member named BuildOptionsMenu.  This member has the same function as the RebuildMenus member, but it is the one that is actually used in the Debug version of the game.  On line 1384, add:
[code]
// MUSIC added by ahenobarb
m_mainMenuBar->AddMenuItem(menu,(char*)g_theStringDB->GetNameStr("str_ldl_Music"),
		KeyListItem::GetKeyFromKMScreen(theKeyMap->get_keycode(KEY_FUNCTION_MUSIC_OPTIONS)),(void *)CP_MENU_ITEM_12);
[/code]

5)  The rest is just a matter of adding strings to text files.

	In the “C:…\ctp2_code\ctp” directory open “userkeymap.txt” and add “^m Music” to the bottom of the list

	In the GAME directory “C:…\Call To Power 2\ctp2_data\english\gamedata” not the source code directory, open “Add_str.txt” and add “Str_ldl_MusicHotKey “Ctl+m”” after “…SoundHotKey”

	In “ldl_str.txt” under “#Options Menu Strings”, add “str_ldl_Music “Music”” then search for “str_ldl_SOUND” and underneath “..SOUND” and “..SOUND_OPTIONS” add similar entries for “..Music” – Do not put the text within the quotes in all caps, this is the text that will appear on the screen.

	In “keymap.txt” add at the bottom “^m MUSIC_OPTIONS”

	**** It is important to note that if the string names listed in the .txt files do not agree in case with the string names list in the functions, the game will crash.  That means that “ldl_str_MUSIC” listed in the .txt files will cause a crash if the string name is “ldl_str_Music” in the function