Announcement

Collapse
No announcement yet.

DEBUG: sucess with the sound! :)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    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 solution to that one is in a clear text file called something akin to "playlist" somewhere in the gamedir as far as i can recall

    Comment


    • #17
      So... why am I getting the mss32.dll not found with this fix? Do I need to compile the DLL myself, or what?
      Solver, WePlayCiv Co-Administrator
      Contact: solver-at-weplayciv-dot-com
      I can kill you whenever I please... but not today. - The Cigarette Smoking Man

      Comment


      • #18
        where are you running the ctp2.exe from? that dll is in the regular game directory (along with mss16.dll)

        Comment


        • #19
          Bah, never figured I could look there...
          Solver, WePlayCiv Co-Administrator
          Contact: solver-at-weplayciv-dot-com
          I can kill you whenever I please... but not today. - The Cigarette Smoking Man

          Comment


          • #20
            const's

            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...

            Comment


            • #21
              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.

              Comment


              • #22
                Right... but if these aren't working, why is it working?

                Comment


                • #23
                  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.

                  Comment


                  • #24
                    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; November 8, 2003, 15:44.

                    Comment


                    • #25
                      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!!

                      Comment


                      • #26
                        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!!
                        Attached Files
                        Last edited by ahenobarb; November 9, 2003, 14:24.

                        Comment


                        • #27
                          To be precise there is a way to access the sound window from within the game, just press escape. But of course it has also to be on the drop down menue. And another tip ahenobarb, it is much easier to add your modification if you can provide edited files instaed of plain code.

                          -Martin
                          Civ2 military advisor: "No complaints, Sir!"

                          Comment


                          • #28
                            Yes, but what fun would that be?

                            At anyrate, I learned how the menu bar is coded, so I can add stuff there later, if I want.

                            Attached is a .zip file with the modified code.
                            Attached Files

                            Comment


                            • #29
                              Thank you very much, looks like I can't include it into the nect version of the altered source files pack to many files.

                              -Martin
                              Civ2 military advisor: "No complaints, Sir!"

                              Comment


                              • #30
                                Huh? Just copy these files over the originals in the Source Directories and recompile (It only takes a minute) then take add_str.txt, ldl_str.txt, and keymap.txt and put them in the game directories. It should work. Of course, if you have added your own strings to these .txt files you can cut and paste them in.

                                Of course, I may not be understanding your problem correctly. Let me know if I can help.

                                Comment

                                Working...
                                X