elishacloud / Silent-Hill-2-Enhancements

A project designed to enhance Silent Hill 2 (SH2) graphics and audio for the PC. It also includes scripts to build or modify SH2 audio files (SFX, BGM and Dialog).
http://www.enhanced.townofsilenthill.com/SH2/
zlib License
574 stars 41 forks source link

Disable (and in one spot: enable) the ability to save in certain rooms #118

Closed Polymega closed 2 years ago

Polymega commented 5 years ago

@Bigmanjapan found another interesting issue with the ability to save/load almost anywhere:

If you go on the Hospital's roof the ability to save will be disabled, as the game is waiting on you to go near the diary then trigger the RPT ambush attack.

However, if you don't go near this journal you're able to go back down the staircase from which you came, but upon doing so the ability to save will still be grayed out everywhere you go until you either 1) load another save or 2) trigger that rooftop cutscene.

To resolve this (enable/disable saving address found by Bigmanjapan):


This re-enables the ability to save if a person enters the roof but decides to go back down without triggering the cutscene.


We disable this for the Flashlight & Mannequin apartment room because, if you load back into this room a blood pool will form prematurely around the dormant Mannequin (before it comes to life) and the Mannequin will spin around erratically as it comes to life.

We disable this for the Pyramid Head apartment room because, if someone saves within the closet, the camera will be completely blacked out upon game load here.

We disable this for the Hotel stairs on fire because, if you load back into this area, the fire and smoke effects won't render.


For this one we need to prevent saving in a specific room WHILE James' X coordinate is less than a certain float value. This is to prevent getting trapped in the Labyrinth elevator as reported here.

As soon as the elevator stops moving there's an instruction to re-enable saving. The problem is, saving the instant you regain this feature is what causes the bug linked above. So we need to modify this instruction to prevent the game from allowing us to save again the moment the elevator stops, and instead reactivate saving once we fully exit the elevator (via James' coordinates).

sh2pc.exe+1831BA (005831BA)
Change mov [0079B830],00000001 to mov [0079B830],00000000

Once we change that, we do the following:

In regards to James' position: Being a negative value, less than -18600 would be something like -18750 and greater than would be something like -18425.

To maybe help save some time, you've used the James coordinate address before in the HospitalChaseFix mod found here: https://github.com/elishacloud/Silent-Hill-2-Enhancements/blob/master/Patches/HospitalChase.cpp#L35


To anyone else reading this: Remember: The ability to save/load almost anywhere is an awesome feature uniquely built-in to the PC version, and once you start using it you'll become spoiled by just how nice it is. However, there are bound to be hiccups from this feature, as it is a bonus feature not built-in to any other version.

elishacloud commented 2 years ago

This should be fixed now. I changed it as specified.

Here is the testing build: d3d8.zip

Polymega commented 2 years ago

This one was super-easy to test. Works great on all binaries. Thank you!

elishacloud commented 2 years ago

Fixed in to check-in: 57e86ecacc5a3eaf224d8080a2aecb33023d363d

Polymega commented 2 years ago

If there was a contest for which ticket has been re-opened the most this one would win, hands down. :laughing:

Part of GameLoadFix is disabling the ability to Quick Save while in-game voice events happen. You can see the original post for this here.

We are using 0249C810 byte (in-game voice event) to know this. However, 0249C810 is an ADX function address and Gemini must null it for his Criware reimplementation fix. Therefore, we can no longer use this address for our needs here.

We need to use a different address to monitor this. Can we please change the InGameVoiceEvent variable from using 0249C810 byte to 01F7A7CC byte? The logic here can be simplified and will also need to change to the following:

if (*InGameVoiceEvent != 0 || GetFullscreenImageEvent() == 2)

Additionally, later on in this feature's life Aero_ submitted some ASM changes for this feature. As such, there is some old, redundant code that I believe can be removed. This portion of code can be removed.

Upon this code removal, I believe this chunk of code can be merged with this chunk of code, correct?

I'm thinking all these changes are right/good, but I'll need to test afterwards. Thank you!

elishacloud commented 2 years ago

Can we please change the InGameVoiceEvent variable from using 0249C810 byte to 01F7A7CC byte?

Done.

Upon this code removal, I believe this chunk of code can be merged with this chunk of code, correct?

Correct.

Does the save still need to be blocked for InGameVoiceEvent only when in rooms 0x0A and 0xBA, like shown here? I assume we only want to block the save in these two rooms during in game voices. So I kept that.

Here is the testing build for v1.0 only: d3d8.zip

Polymega commented 2 years ago

Does the save still need to be blocked for InGameVoiceEvent only when in rooms 0x0A and 0xBA, like shown here?

I believe we drop the specified room requirement as this new address should cover all our bases now with in-game voice events.

If you wouldn't mind also supplying a build with that change I can test both when I return home tonight and let you know which one is the keeper.

Thank you sir

elishacloud commented 2 years ago

I believe we drop the specified room requirement as this new address should cover all our bases now with in-game voice events.

Ok, I build a new update for v1.0 with that change: d3d8.zip

Polymega commented 2 years ago

Thanks, Elisha! The latter (second) build right above this post is good for implementation into all binaries.

elishacloud commented 2 years ago

Are you sure it works on all binaries? I hard coded this address: 01F7A7CC. Is this address the same on all binaries?

Polymega commented 2 years ago

I worded that very poorly, sorry. It only works for 1.0 but the changes are good and can be implemented for the other binaries now.

Sorry for the confusion and thank you again.

elishacloud commented 2 years ago

This update should work with all binary files.

Testing build: d3d8.zip

Polymega commented 2 years ago

Yep, it does! Thank you!

Polymega commented 2 years ago

For my own records:

Spots where 01F7A7CC byte (in-game dialogue events) trigger. This is for in-game dialogue (i.e. dialogue that happens outside of cutscenes) that would usually also trigger subtitles:


@elishacloud We found a slight problem with 01F7A7CC in that, if its value gets triggered and you exit the room before the dialogue event fully completes, the value doesn't clear itself moving forward. When this happens, it totally locks out quick saving until you exit back to main menu.

An easy way to fix this would be to add a conditional check for InGameVoiceEvent:

elishacloud commented 2 years ago

An easy way to fix this would be to add a conditional check for InGameVoiceEvent:

Ok, I made the requested change.

Testing build here: d3d8.zip

Polymega commented 2 years ago

Works great! Thank you, Elisha.

I'll see you in about a week or two when we re-open this ticket again, lol!

elishacloud commented 2 years ago

I'll see you in about a week or two when we re-open this ticket again, lol!

Haha! At least these ones are pretty easy to fix...