Tycho Posted February 27, 2012 Share Posted February 27, 2012 I was wondering if anyone has been able to locate the code that handles how the stun rod works. Link to comment Share on other sites More sharing options...
kyrub Posted February 27, 2012 Share Posted February 27, 2012 What do you need, Tycho? Link to comment Share on other sites More sharing options...
Tycho Posted February 28, 2012 Author Share Posted February 28, 2012 What do you need, Tycho?People have pointed out that changing the data in OBDATA.DAT for the stun rod does not alter how it works. The consensus being is that it is hard-coded into TACTICAL. I wanted to know if anyone has ever located the offsets for this code. Also, I was hoping to look at the sound problems in battlescape. Link to comment Share on other sites More sharing options...
NKF Posted February 28, 2012 Share Posted February 28, 2012 Changing obdata.dat will alter the stun rod. I've made a combat knife out if before, a grenade-knife, and I think a gun with a melee attack. What is hardcoded is the 'stun' menu command, and I guess the bullet image. It will default to a cannon round. - NKF Link to comment Share on other sites More sharing options...
Tycho Posted February 28, 2012 Author Share Posted February 28, 2012 Changing obdata.dat will alter the stun rod. I've made a combat knife out if before, a grenade-knife, and I think a gun with a melee attack. What is hardcoded is the 'stun' menu command, and I guess the bullet image. It will default to a cannon round. - NKF OK. My misunderstanding. So is the problem with the sounds in the CE version a problem with the CAT file or is it a reference problem in TACTICAL? Link to comment Share on other sites More sharing options...
kyrub Posted February 28, 2012 Share Posted February 28, 2012 What problem? Link to comment Share on other sites More sharing options...
Tycho Posted February 29, 2012 Author Share Posted February 29, 2012 What problem? In CE, the sound for the stun rod is incorrect. When using the stun rod, it sounds like snakeman movement. There are other events were the sound is incorrect. I've check the downloads section and there are patches that fix some sound issues but not ones like the stun rod... Link to comment Share on other sites More sharing options...
NKF Posted February 29, 2012 Share Posted February 29, 2012 It's not just the stunrod. Listen to the snakeman movement sound. Some sound effects seem to play over into the next sound clip. The little click you hear in between the sounds is probably just some data between the audio. I think the DirectX functions that play audio must be expecting more raw audio than there is. - NKF Link to comment Share on other sites More sharing options...
kyrub Posted February 29, 2012 Share Posted February 29, 2012 It's not just the stunrod. Listen to the snakeman movement sound. Some sound effects seem to play over into the next sound clip. The little click you hear in between the sounds is probably just some data between the audio. I think the DirectX functions that play audio must be expecting more raw audio than there is. I thought one of the UFO Extender ini options takes care of this? Link to comment Share on other sites More sharing options...
Tycho Posted February 29, 2012 Author Share Posted February 29, 2012 I thought one of the UFO Extender ini options takes care of this? It's not the CAT file. I just played around with it and learned how it is setup. Then I changed it up and things worked as I expected. The first part is just a series of offsets and string lengths. The executable uses this data to map the entire corresponding offset entry in to a database format of commands to play the raw data string. I was able to change the first entry to the correct sound of the stun rod and the third entry to the snakeman slither. Now snakemen slither and zap when moving. It appears that there is somewhere in the database that references what dword entry is for each object and alien. In the case of snakemen there must be two entries that point to the first and third entries in the database for movement. Link to comment Share on other sites More sharing options...
kyrub Posted February 29, 2012 Share Posted February 29, 2012 My very last attempt to put a question (since none of previous three I put so far in this thread got an answer): Did you, Tycho, try this special program called UFO extender to correct your problem? Link to comment Share on other sites More sharing options...
Tycho Posted March 1, 2012 Author Share Posted March 1, 2012 My very last attempt to put a question (since none of previous three I put so far in this thread got an answer): Did you, Tycho, try this special program called UFO extender to correct your problem? The one created by Seb76? I've been running that since the beginning since I had the problem with the garbled graphics. In the extender, there are options to fix the freezing/pausing when the music changes, change the music that plays at each screen, and reintroduce the sounds and music to the intro but nothing to address the problems with incorrect sounds played when the stun rod is used or snakemen, celetids, and zombies move. I never had problems with any "clicks" at the end of sounds. Yesterday, I looked at SAMPLE2.CAT. After learning how the file is organized, I inserted the stun rod "zap" into slot 1 of the file and moved the snakeman "slither" to #3. This fixed the stun rod but snakemen now slither and "zap". This tells me there is somewhere in TACTICAL or another file that tells the program what sound(s) to use when certain alien units move. I know that the various MCD files tell the program what sound to use when agents move through them but tanks/hovertanks always use the same sound. Don't the "walking" aliens (sectoids, mutons) only make one sound when moving despite the terrain? Which leads me back to the original reason for starting this topic. I thought if someone could tell me the location of the code that deals with how the program adds the "stun" option to the menu in TACTICAL, it might give me a starting point to help locate where the program looks to play the sound when one chooses to stun. Link to comment Share on other sites More sharing options...
Tycho Posted March 2, 2012 Author Share Posted March 2, 2012 (edited) After pouring over the code...beating my head against a table...and repeating the process several times...I think I found a solution for several of the wrong sound effects for CE. change byte 45DC5E to 06, snakeman movement is fixed somewhat (no explosions) 45DC61 to 06, fixes Celatid movement (no explosions) [see my later post] For the stun rod: 45DC76 to 06475954 to 36--------------------the sound subroutine starts at 45D960. The section that handles battlescape sound effects starts at 45DA7C. 45DC5C starts a table of 55 bytes which holds data on how the program should handle the reference for the sound call and passes that to a switch jump:00 - 45DAAA (reference the appropriate MCD info for the unit walk sound)01 - 45DB0C (routine to play the move sound uninterrupted. a bug caused a second sound to play for some units)02 - 45DB33 (just clears the value that was called, then jumps to play a sound) [i think there is an error here and the code should jump to the end of the subroutine but doesn't so you get snakeman movement played instead of nothing hence the stun rod problem]03 - 45DB3A (randomly determines which of the two UFO door sounds to use)04 - 45DB58 (randomly determines which of the three human male death screams to play)05 - 45DB71 (same as above but for females.)06 - 45DBBA (play the sound normally) 4758EC starts the dword database that lists the reference numbers for the offsets at the beginning of SAMPLE2.CAT. There seems to be several errors in this subroutine just in the section for battlescape. The stun rod was an oversight but I think the snakeman is intended to have an echo effect for his movement but the way the program passes the data from the subroutine that plays the extra sound to the section that usually plays the sound, glitches on 3 (which is the actual snakeman movement refernce #) so it plays an explosion in the normal subroutine.Same with the celatid. I just changed their reference numbers from 01 to 06. I think think the reference for the zombie is very messed up. It seems that the zombie is actually referencing the same number as small explosions. Edited March 8, 2012 by Tycho Link to comment Share on other sites More sharing options...
kyrub Posted March 2, 2012 Share Posted March 2, 2012 I still don't get it. I have been playing CE version with no sound problem. Sorry for being a bit non-polite. Link to comment Share on other sites More sharing options...
Tycho Posted March 3, 2012 Author Share Posted March 3, 2012 It's not just the stunrod. Listen to the snakeman movement sound. Some sound effects seem to play over into the next sound clip. The little click you hear in between the sounds is probably just some data between the audio. I think the DirectX functions that play audio must be expecting more raw audio than there is. - NKF I've never noticed "click" myself. The snakeman and celatid were giving me explosion sounds. The stun rod sounded like the snakeman slither. The zombie sounds like he is carpet bombing the entire area when he walks. Do you still have these problems? Link to comment Share on other sites More sharing options...
Tycho Posted March 3, 2012 Author Share Posted March 3, 2012 I still don't get it. I have been playing CE version with no sound problem. Sorry for being a bit non-polite. Could you post the byte info of your UFO.EXE from 45DC5C to 45DC93 and 4758EC to 475A2B? What mods/patches are you running as well? Link to comment Share on other sites More sharing options...
Tycho Posted March 7, 2012 Author Share Posted March 7, 2012 (edited) I'm not sure why some people don't seem have these problem anymore: Snakemen, celatids, and zombies make all sorts of different sounds when they walk and the stun rod sounded like the snakeman slithering.The sound of explosions whenever the zombie took a step was the most annoying to me. I even got another copy of CE and installed it just to verify the problem wasn't that I had some strange old copy of CE. Nope, sound problems still occurred in the new download. Finally...I worked out most of them: ZOMBIEThe routine that sets some initial values for dwords sets the entry related to the zombie to 18. I have no idea why this line is necessary. Except for the initial setup the dword section is only read by other routines. Fix: Change 0x425232~9 to 90 (nop) and 0x46D1F0 to 00 and it will play the correct walk sound as per the tile set. SNAKEMEN&CELATIDS The program tries to ensure that their movement action plays the whole sound file uninterrupted by another move action (as well as flying units, silacoids, tanks, and hovertanks/cyberdisks). To do this, it plays the file and then is supposed to reference a null location for the normal sound event (I think). However, the calculation for the location was wrong. Fix: Change 0x45DB2D to 43 seems to fix the problem for each of them and not cause new ones to arise for the other creatures that use the same routine. STUN ROD & OTHERI think the programmers intended to use this as a default sound option to bug test the sound section as they changed the references but then left it "as is" with the result that any 02 reference in the database will default to the 00 reference in the CAT file. Except for the stud rod, most of the areas set to 02 don't seem to have a corresponding event that would call them, 02 should probably mean "no sound". Fix: Change 0x45DC76 to 06 and 0x475954 to 36 will set the correct sound for the stun rod. Fix: Change 0x45DB36 to C2 will make any 02 reference not play a sound. Did the zombie "hatching" ever play a sound in the DOS version? I thought it did but have not heard in in CE or 1.4 with DOSbox. Edited March 26, 2012 by Tycho Link to comment Share on other sites More sharing options...
Bomb Bloke Posted March 7, 2012 Share Posted March 7, 2012 I had a memory of the zombie making explosions, but couldn't remember anything about snakeman weirdness (or any other units, for that matter). Tried them just now and they do indeed make a what sounds like a cannon shot at the end of each slither. Guess I haven't fought them in CE all that much, or something. Link to comment Share on other sites More sharing options...
Tycho Posted March 8, 2012 Author Share Posted March 8, 2012 I had a memory of the zombie making explosions, but couldn't remember anything about snakeman weirdness (or any other units, for that matter). Tried them just now and they do indeed make a what sounds like a cannon shot at the end of each slither. Guess I haven't fought them in CE all that much, or something. Thanks for confirming my findings BB. I guess people are using the DOSBOX version more due to all the graphics and timing issues with CE, they have grown accustomed to the sounds, or some have patched it but that knowledge got lost (I even used all the patches in the latest version of XCOMUTIL but with no success). Does Seb76 still work on his loader? (also, could you rename this topic to "Wrong Sounds in Collector's Edition"? It would be more appropriate since this discussion evolved into more than just the stun rod.) Link to comment Share on other sites More sharing options...
Bomb Bloke Posted March 8, 2012 Share Posted March 8, 2012 I've renamed the thread, but just so you know, if you wanted to do it yourself you can just go edit your first post. You'll need to use "full" rather then "quick" edit mode. The far reaches of my memory are telling me that whether the sound problems with movement occur have something to do with the surface the creature is moving over. Which makes sense when you consider that different floors make different sounds anyway, but maybe not so much for the snakemen... Some people (not me) use this patch to restore old alien voices to later versions of the game. Dunno how it affects the other sounds, but you might find it interesting if you haven't seen it already. I haven't seen any signs from Seb for quite some time. He hasn't touched UFOpedia.org since about May 2010. Link to comment Share on other sites More sharing options...
kyrub Posted March 8, 2012 Share Posted March 8, 2012 Xcomufo.com has also the corrected music.dll for CE version. That's not the answer? https://www.xcomufo.com/x1dl.html Link to comment Share on other sites More sharing options...
Tycho Posted March 8, 2012 Author Share Posted March 8, 2012 I've renamed the thread, but just so you know, if you wanted to do it yourself you can just go edit your first post. You'll need to use "full" rather then "quick" edit mode. Thanks BB! (BTW, I must not have sufficient access to do this. I tried your directions but under full edit I didn't see a way to access the Title to alter it.) The far reaches of my memory are telling me that whether the sound problems with movement occur have something to do with the surface the creature is moving over. Which makes sense when you consider that different floors make different sounds anyway, but maybe not so much for the snakemen... You're right. Any unit that is walking on "feet" is given the sound event id #00 which tells the sound routine to reference the tile set to determine which lines from the CAT file to play and alternate between the two to get the sound of steps. Other creatures have a set sound for their movement (snakemen, flying units, celatids, tanks,etc..). The zombie's problem is that when the game loads, the subroutine that initializes a lot of the data points sets the dword for the zombie's move event# to be the event ID of the small explosion (#18). So changing that dword entry for the zombie with an editor never fixes the zombie problem because your entered value is overwritten when you start the game. I was a little lucky that in the starting routine code they use the specific dword. I probably would still be trying to solve this if I hadn't finally used a program that allowed me to view the memory locations in real time. It's amazing what happens when you use the right tools.. I haven't seen any signs from Seb for quite some time. He hasn't touched UFOpedia.org since about May 2010. I thought that I had not seen any activity from him but I'm still new here and to UFOpedia. Too bad. I had hope to offer my results on the sounds and fixes for code to the craft weapon's ufopaedia pages to him for inclusion on a future update. Link to comment Share on other sites More sharing options...
Tycho Posted March 8, 2012 Author Share Posted March 8, 2012 (edited) Some people (not me) use this patch to restore old alien voices to later versions of the game. Dunno how it affects the other sounds, but you might find it interesting if you haven't seen it already. I checked out the files that are in the "patch". The SAMPLE2.CAT file is definitely got the original sound samples: I didn't realize how bad the human screams were (the female screams sound more like a group of girls squealing.) Others I don't ever remember hearing.But there are a few things I don't like about it:1. He doesn't provide any documentation to tell you what has been changed in the code or the files, to help in case another mod conflicts with some of his changes.2. I noticed the "clicking" problems people have mentioned. 3. The patch doesn't fix any of the problems that I have been working on. (Stun Rod, Snakemen movmenent, etc) I may take a longer look at it and try to determine what I might can do with the new sounds but I would have to look deeper into the code to see how to give a new sound ref # to certain creature's actions. UPDATE-I just disassembled the modified executable and compared it to the original. The author alters some of the sound routines and injects his own code into the empty spaces in order to reorganize the sounds instead of using the existing structures and modifying code only as much as necessary. He still doesn't address the problems with incorrect sounds being played and seems to cause others (clicking at the end of many sound events). I doubt that using this altered executable would work with seb's loader and I am unsure how it would react with XCOMUTIL. Edited April 30, 2012 by Tycho Link to comment Share on other sites More sharing options...
Tycho Posted March 8, 2012 Author Share Posted March 8, 2012 Xcomufo.com has also the corrected music.dll for CE version. That's not the answer? https://www.xcomufo.com/x1dl.html I think that file fixes the pauses between music changes especially as one goes back-and-forth between the music for an interception and normal geoscape music. The problems I've been working on are some of the sound effects in battlescape. Mostly dealing with the wrong sounds for certain creatures movements and the stun rod. I appreciate your help. I am using Seb's loader, I've tried various CAT files from here and xcomufo.org, and tested XCOMUTIL but none of them ever fixed these problems. My coding skills aren't near the level of BB, Seb, or Blade. I just started learning assembly in December. All these problems are really cosmetic but since no one has fixed them, they give me a good focus as I learn. Link to comment Share on other sites More sharing options...
kyrub Posted March 8, 2012 Share Posted March 8, 2012 I thought that I had not seen any activity from him but I'm still new here and to UFOpedia. Too bad. I had hope to offer my results on the sounds and fixes for code to the craft weapon's ufopaedia pages to him for inclusion on a future update.Seb has posted a full source for UFO extender on Ufopaedia, so it's quite simple to include your sound fixes in the final release. I can help with it, if you're not familiar. And pardon my initial mistrust, I thought you were referencing something that has been solved long ago. It's really good you noticed the problems and you even found a solution yourself. If ever you need some info/coding help, just ask. Then again, sound and graphics are my worst enemies when it comes to disassembling... so I am probably not the best advisor around. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now