 |
|
Fromafar
|
|
The parameter and return types should be correct, except for the WINAPI AIL_redbook_track function. I expect that the return type will not be bool, but rather something like S32 or U32. You may have to remove the const qualifiers with the parameters (unlikely for an extern "C" interface).
The main issue will be finding the actual code values for the names in the enums. These are unlikely to be correct.
|
|
|  |
 |
|
jonwil
|
|
That its actually working without crashes or problems?
|
|
|  |
 |
|
MrBaggins
|
|
where are you running the ctp2.exe from? that dll is in the regular game directory (along with mss16.dll)
|
|
|  |
 |
|
rheinig
|
|
Beautiful. But I need to reiterate: some of the const declarations are obviously wrong and might damage optimized builds, namely:
AIL_quick_handles
AIL_quick_load_mem (I'd be unsure about a_Dataptr)
AIL_redbook_track_info
Just dropping a few const keywords should suffice.
Seeing someone confirmed this actually works - I'm dead curious how you found the correct values for the constants, especially the 4 redbook ones. lucky guess?
have phun...
|
|
|  |
 |
|
Fromafar
|
|
Noone has claimed that these values are correct. Actually, I think it is pretty unlikely they are. From personal investigation with the debugger, I can confirm that at least the ..._ERROR values (first enum value = 0) are correct.
But I definitely would like to see someone with a working sound card confirm the values for QSTAT_DONE and REDBOOK_STOPPED. The other ones (REDBOOK_PLAYING and REDBOOK_PAUSED) are not that relevant. These are mentioned in the code (SoundManager.cpp), but do not trigger any action.
|
|
|  |
 |
|
Fromafar
|
|
Maybe it is working only most of the time, for not everyone?
The AIL_redbook_status will be checked every 4 seconds, so you may have all kinds of timing related issues that are difficult to trace.
|
|
|  |
 |
|
ahenobarb
|
|
quote: Originally posted by J Bytheway
Seems to work just fine. I still have that ever-repeating track 1 bug, but that's not new... |
The problem is that everytime you start the game, Auto Repeat is always set to on unless you go into the options menu and change every time. (If you change it in the options menu before you start the game, the songs will cycle).
I looked through the code and the problem is a line in Soundmanager.cpp A variable there is always set to TRUE.
line 84 is:
code:
m_autoRepeat = TRUE;
change it to:
code:
m_autoRepeat = FALSE;
That should ensure that the default setting for auto repeat when the game starts is FALSE. My copy of VC++ hasn't arrived yet, so I can't test it, but it should fix the problem.
Last edited by ahenobarb on 09-11-2003 at 00:44
|
|
|  |
 |
|
ahenobarb
|
|
Finally got my compiler and compiled the code. The change I suggested above fixes the problem. You don't have to manually set auto repeat to "off" everytime you start a game. What an annoyance!!
|
|
|  |
 |
|
ahenobarb
|
|
Here's something else cool that I did. It's more of a GUI modification, but it pertains to the sound.
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,
add:
code:
KEY_FUNCTION_SOUND_OPTIONS,
// MUSIC added by ahenobarb
KEY_FUNCTION_MUSIC_OPTIONS,
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"},
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"
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;
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"
You need to add music to the list of choices in the menu bar. [It should be noted that line 100 of controlwindowpanel.h enumerates the CP_MENU_ITEM type and limits the menu bar drop down lists to 15 items, if you need more than 15 items, you need to add them to CP_MENU_ITEM.] 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;
**** 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);
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);
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
I compiled it and there are no problems. I attached a how-to file for downloading. Good luck!!
Attachment: add music to options.rtf
This has been downloaded 3 time(s).
Last edited by ahenobarb on 09-11-2003 at 23:24
|
|
|  |
All times are GMT. The time now is 05:31. Apolyton Time is 00:31. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|