Sound glitch and crash when player is hit [Solved]

JeffPack

New member
Making an adventure module game. First thing to note is I have not in any way altered any of the scripts.

Whenever my player gets hurt 1 of 3 things happen:
1. The sound starts buzzing and beeping at me
2. The sound starts clicking and beeping and the game freezes
3. The sound starts buzzing and beeping and then after a time it starts clicking and beeping and the game freezes.

I have imported my own music for this project but this happens even when I import the music from the adventure tutorial so it can't be a problem with my own music/sfx.
All I have done up to this point is re-skin the adventure tutorial. I am considering rebuilding the project from scratch to see where the disconnect is.
 

TurtleRescueNES

Active member
Are you using a project created in 4.0.6 and upgraded to 4.0.11?

If so, sounds like someone else also found the same issue:
http://www.nesmakers.com/viewtopic.php?f=27&t=735&start=20
 

JeffPack

New member
jsherman said:
Are you using a project created in 4.0.6 and upgraded to 4.0.11?

If so, sounds like someone else also found the same issue:
http://www.nesmakers.com/viewtopic.php?f=27&t=735&start=20

Yes this is directly related however I am using a brand new 4.0.11 project, not an upgrade.
I changed the PlaySound instruction from the label to the actual sound name and it works fine now.
 

jorotroid

Member
I'm having this issue, too. I was thinking it might be related to the issue with even number music tracks not playing as brought up in this thread:
http://www.nesmakers.com/viewtopic.php?f=23&t=758

So I tried replacing SFX_PLAYER_HURT with different labels like SFX_GET_COIN, SFX_PLAYER_LOSE, etc. The only one that causes the game to crash is SFX_PLAYER_HURT. My best guess is that somewhere else in the code, that value is getting reassigned so when it gets called in the player hurt code, it jumps to some random place in memory that causes the crash.
 

jorotroid

Member
Thought of trying something else to try and found a work around. The problem seems to be specifically with the text "SFX_PLAYER_HURT" so if you rename the label to "SFX_HURT_PLAYER" it will play fine (don't forget to also change it in the code in Platform_HandlePlayerHurt.asm. This doesn't solve whatever is going wrong under the hood, but it can get it so can get back to working on other things and not worry about this for now.
 

JeffPack

New member
jorotroid said:
I'm having this issue, too. I was thinking it might be related to the issue with even number music tracks not playing as brought up in this thread:
http://www.nesmakers.com/viewtopic.php?f=23&t=758

So I tried replacing SFX_PLAYER_HURT with different labels like SFX_GET_COIN, SFX_PLAYER_LOSE, etc. The only one that causes the game to crash is SFX_PLAYER_HURT. My best guess is that somewhere else in the code, that value is getting reassigned so when it gets called in the player hurt code, it jumps to some random place in memory that causes the crash.

This is the right answer that fixes the problem.
 

kwatkins

New member
Noob here, having the same issues. Could you clarify what you mean? I've switched SFX_PLAYER_HURT around a dozen times in Platform_HandlePlayerHurt.asm with no luck.
 

jorotroid

Member
I found the specific point that caused the problem! This is another way to fix this. If you go into Constants.asm (in the GameEngineData\GameData folder) you will find on line 281, SFX_PLAYER_HURT gets defined. If you comment this out (put a ; before it) then the label will work properly. I am 95% sure that this is old defines from an earlier version/Mystic Searches and shouldn't cause any problems if you comment it out. In fact, I'm pretty sure you can comment out all of those SFX labels (a quick way to do this in Notepad++: Highlight what you want commented out, then press CTRL-Q). But if you want to play things on the extremely safe side, you probably don't want to give any of your sound effect labels in NESmaker the same name as the ones listed in Constants.asm.

kwatkins, sorry, I guess I wasn't subscribed to this topic, so I didn't notice your question. Let me know if anything I said here need more clarification.
 
Top Bottom