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
562 stars 41 forks source link

Woodside Apt. Room 205 Fixes #5

Closed Polymega closed 4 years ago

Polymega commented 6 years ago

@Bigmanjapan I'd like to keep the gravy train rolling with how knowledgeable you are with so many issues and their solutions.

Is there a way to darken the mannequin dress, James' back, and dormant Mannequin before acquiring the flashlight?

sh2pc 2018-05-28 17-45-55 sh2pc 2018-05-28 17-45-47

It also totally ruins the surprise of the Mannequin coming to life before you obtain the light. I also tested this on the vanilla PC version (no fixes being used) and these lighting issues are still present. In the PS2 version the Mannequin is as dark as the other objects around it before obtaining the light.

If you turn off the flashlight after you obtain it the dress and Mannequin monster will be properly dark:

sh2pc 2018-05-28 17-46-24

Is there maybe a function that can be written such as:

IF inside Room 205 AND flashlight is not in James' inventory THEN correctly darken dynamic objects (dress, James, Mannequin monster) inside this area?

Polymega commented 6 years ago

Here's a PS2 screenshot just for fun. The lighting is a bit different overall for James, the dress, and the Mannequin.

In the PC version James, the dress, and the Mannequin are completely luminescent to some degree. Notice how, in the PS2 screenshot below, James' backside is completely dark (along with the Mannequin). On the PC version even James' back is illuminated. That may be affecting things...

image

Polymega commented 6 years ago

I'm going to guess the light source is overall too strong from the flashlight before acquiring it in this room? So strong that it both lights up the Mannequin and James' backside even when he's looking directly at the light.

Bigmanjapan commented 6 years ago

Isn't it the same issue discussed here? ThirteenAG/WidescreenFixesPack#409 Flashlight on the mannequin stand is controlled via the same code as the one James carries. A mannequin monster behind is a dynamic object, so there is no shadow on it? If the issue with flashlight is fixed, then the mannequin would be dimmed properly.

It is possible to crank up shadows though: https://youtu.be/uk00OxQstV4

These two sets of addreses control lightning / shadows intensity:

sh2pc.exe+542A40 (00942A40) float red channel sh2pc.exe+542A44 (00942A44) float green channel sh2pc.exe+542A48 (00942A48) float blue channel

sh2pc.exe+542A50 (00942A50) float red channel sh2pc.exe+542A54 (00942A54) float green channel sh2pc.exe+542A58 (00942A58) float blue channel

Once you pick up the flashlight the values are reset to their default values, so if you want to implement this solution then a single time change of the values is needed upon entering the room (with the condition that James doesn't carry the flashlight).

Polymega commented 6 years ago

Isn't it the same issue discussed here? ThirteenAG/WidescreenFixesPack#409 A mannequin monster behind is a dynamic object, so there is no shadow on it?

No, I don't believe so. Because this isn't an issue with shadows being cast on the dormant Mannequin. When James is in front of the flashlight the Mannequin in the back will not have a shadow cast on it (the same is true for the PS2 version).

Please note when I say shadow I mean this. To confirm: When you say shadow are you referring to this (below)?

image

If that is what you mean, then I think the issue may be a combination of "shadows" (dark areas on the model) and highlights (from the light intensity of the flashlight on the mannequin).

If we brighten your photo (taken from the YouTube video) and look at it again we can see the Mannequin and James' back are still fairly luminescent which is not what we want. Also, the Mannequin's model looks "weird" because of how harsh the light-to-dark areas are on its body now:

image

And for comparison, here is the PS2 photo brightened. Notice how the dormant Mannequin blends in exactly the same as the random mannequin pieces behind it on the sofa. Also notice how James' back is still solidly dark overall. The dress on the PC version becomes completely washed out due to how intense its original brightness already was. But we can still see some detail on the brightened PS2 photo because the dress wasn't originally too bright to begin with:

image

Also, we if compare your photo to the PS2 photo we can notice how the mannequin dress is almost glowing because of how bright it is:

untitled-1

This is why I think it may be the light's intensity causing issues?

Is there a way to decrease the light intensity of the flashlight on the mannequin dress? Has this been attempted? I'm wondering if you decrease its intensity then perhaps the dress, Mannequin monster and James' back would become correctly dark again as well? And maybe by decreasing the light intensity you would not have to adjust the "shadows" (dark areas on the models) as much or at all?

Polymega commented 6 years ago

These two sets of addreses control lightning / shadows intensity:

sh2pc.exe+542A40 (00942A40) float red channel sh2pc.exe+542A44 (00942A44) float green channel sh2pc.exe+542A48 (00942A48) float blue channel

sh2pc.exe+542A50 (00942A50) float red channel sh2pc.exe+542A54 (00942A54) float green channel sh2pc.exe+542A58 (00942A58) float blue channel

Please double-check my statement here but I don't think those addresses affect the Mannequin monster, James, or the dress as we'd like.

If you set all these values to 0 the Mannequin monster, dress, and James will be darkened but so will the rest of the room. But the rest of the room (outside of the flashlight area) will be pitch black which is not the result we would be looking for. We'd be looking to keep the darkness of the room as-is but only darken the Mannequin monster, dress, and James' to better match the current darkness of the room.

It seems like the Mannequin monster, dress, and James have another set of addresses/values that affect their luminosity in addition to the addresses you stated above.

So now that I understand that...

Isn't it the same issue discussed here? ThirteenAG/WidescreenFixesPack#409 If the issue with flashlight is fixed, then the mannequin would be dimmed properly.

This may be related to that issue after all...

Polymega commented 6 years ago

Okay, now I'm just unsure... Because once you equip the flashlight the Mannequin and dress are properly darkened even when the light is on so long as the objects are behind James' flashlight:

image

And, as also mentioned, the Mannequin and dress are also properly dimmed once you obtain the light and turn it off:

image

So that means it's not an issue with the flashlight with dynamic objects? Yes? But instead some sort of address(es) that are enabled special just for this room, prior to obtaining the light?

I'm confused now...

Polymega commented 6 years ago

Using the old school flashlight bug fix HACK DX_CONFIG_USE_VERTEX_SHADERS 0 (place this line either in device.fix or local.fix) is a way to fix the issue. But the problem is we don't want to use this hack as it degrades the flashlight's quality to that of the PS2's version. (So instead of using per pixel lighting it will use per vertex lighting.)

@AeroWidescreen you've had first-hand experience with this type of work (when you fixed the flashlight bug without having to use the hack). Would you have any ideas for this?

image

Bigmanjapan commented 6 years ago

To confirm: When you say shadow are you referring to this (below)?

Yes. I meant dimming on the models themselves.

Please double-check my statement here but I don't think those addresses affect the Mannequin monster, James, or the dress as we'd like.

So that means it's not an issue with the flashlight with dynamic objects

It is an issue with the mannequin stand flashlight lightning. Apparently it has a piece of it's own code.

https://youtu.be/UwbLcv6fEJI

sh2pc.exe+3F72F0 (007F72F0) float sh2pc.exe+3F72F4 (007F72F4) float sh2pc.exe+3F72F8 (007F72F8) float

Change these three to any value betwen 2 and 6.

While it seems that these three addresses control only that situation when the flashlight is on the mannequin stand, I would advice to return the values back to 7 once James leaves the room.

Polymega commented 6 years ago

It is an issue with the mannequin stand flashlight lightning. Apparently it has a piece of it's own code.

image

@AeroWidescreen one of these days I'll stop tagging you but not today. :) @Bigmanjapan has done his black magic once again!

Polymega commented 6 years ago

Copying from the discussion found here. @Bigmanjapan also found a way to hide the blood pool that forms around the mannequin when loading into this room before the creature comes to life. This fix can go hand-in-hand nicely with the luminescence fix.

Quoting from his post:

This blood stain is formed via three layers. Change their Y coordinates to shift them underneath the floor. I don't know if something else accesses the addresses, so a single change of value to 128 upon entering the room should be fine. Better to leave the addresses unfrozen to make sure it doesn't break anything else in the game later on.

sh2pc.exe+556364 (00956364) float sh2pc.exe+5563BC (009563BC) float sh2pc.exe+556414 (00956414) float

Change them to 128.

https://youtu.be/0Brt9z60Rew

Interestin fact: blood stain Y position is calculated from mannequin Y position. If you change mannequin Y position via address in the next message, freeze the value and re-enter the room — blood stain will also be shifted on Y axis following the mannquin.

Polymega commented 5 years ago

@Bigmanjapan I've changed the title of this support ticket, as Woodside Apt. Rm. 205 is apparently a mess that needs a lot of love and care put into it. Especially for the PC version, it seems like the game wants to spoil/ruin the mannequin surprise in any way it can.

Anyway, I'll also copy + paste your post here below:

Returning to the mannequin flashlight room. Dormant mannequin is still considered an enemy and on beginner / easy action difficulties James will often go into battle stance mode upon trying to pickup a flashlight if a player has a wooden plank equipped (because an enemy is behind the flashlight).

It's on all official console versions but still doesn't feel right logic wise. It should be possible to disable autoaim for this room until the mannequin is awake.

Polymega commented 5 years ago

So where does this leave us in terms of what to fix?


IF James enters Room 205 at any time:

Specific blood addresses (from v1.0): 00956364, 009563BC, 00956414

If blood values immediately load in as: Change values to:
0 128 *
Not 0 -3 *

*These values should be released upon exiting Room 205!

What does this do? If you Quick Load into this room before acquiring the flashlight, the dormant mannequin will have a pool of blood around it (with values that start off at 0 and become -3). We set this to 128 to hide the blood off-screen. If we then kill the mannequin a new set of addresses are used to spawn a new pool of blood at the correct values of -3 which is perfectly fine.

However, if we RETURN to this room AFTER killing the mannequin the original blood pool addresses are used again for wherever we killed the mannequin (which is great) but are incorrectly set to use a value in the approximate range of -0.00001... - -0.0006... (which is not great). This is a problem because, if the pool of blood spawns over the carpet, the blood's visuals become glitched because it's on the same Y elevation as the carpet itself. See image below. So if the blood value is set to "Not" 0 upon entering the room we set it to -3 so it can rest higher than the carpet, if it pools there.

untitled


IF James enters Room 205 AND the flashlight is not in his inventory:

Fix found? Description Address (v1.0) Original value New value
:heavy_check_mark: Change "luminescence" values so James, mannequin, and dress no longer glow. 007F72F0 (float), 007F72F4 (float), 007F72F8 (float) 7 0 *
Remove "shine" on dormant mannequin until flashlight is acquired. *
Prevent dormant mannequin from spinning around when coming to life (happens if you Quick Load into room). *

*These values should be released upon exiting Room 205!

Bigmanjapan commented 5 years ago

Remove "shine" on dormant mannequin until flashlight is acquired.

sh2pc.exe+4A0020 (008A0020) 4 bytes (the value is actually a float but it's better to treat it as a 4 bytes one in this case)

Find out what writes to the address (F6) and NOP the only instruction that the scanner will show. Then set the value of the address to 0xFFFFFFFF (in float terms you need to put a NaN (Not-a-Number) value here)

I haven't check thoroughly if something else gets broken in the room if the instruction is NOPed. It seems to only operate on the shine of the mannequin. If you freeze the address while the instruction is active, then the shine will be locked at one position regardless of James movement / camera change.

default

Prevent dormant mannequin from spinning around when coming to life

Quicksaving / quickloading in the room is responsible for the wrong mannequin position. I guess the issue is similar to the cemetery colours bug. If you do a run without using quicksaving / quickloading in the room, then the mannequin will be positioned properly.

default

default

In SH2 enemies have all their stats (X, Y, Z position, HP etc) assigned to random addresses each new game or even each new quickload sometimes. I assume it's a measure to save limited memory since it's possible to "fit" all the enemies in the game in a small pool of addresses instead of making a static memory region for every enemy.

Since dormant mannequin is also considered an enemy by the game engine, his stats are also controlled via dynamic allocation system. I think the issue with his position being messed up on quickloading is the dynamic memory system assigning wrong values, maybe from some other enemy still being stored at the same time.

Polymega commented 5 years ago

@Bigmanjapan Just for your records, sh2pc.exe+1B9A903 (01F9A903) byte might have something to do about whether or not the Mannequin in the flashlight room loads incorrectly before acquiring the flashlight.

The byte is set to 0 while in this room when the Mannequin is correctly positioned on the floor. The byte changes to 1 when he's loaded incorrectly before acquiring the light.

After acquiring the light, that byte changes to 1 regardless.

sh2pc.exe+1B9A823 (01F9A823) byte also might have something to do with it, but I'm not sure.