Attempting on-more-often Lamp/Lantern

View previous topic View next topic Go down

Attempting on-more-often Lamp/Lantern

Post by assassin17 on Wed 25 Jan 2017 - 1:23

the SNES game gets rid of the lamp/lantern spotlight as soon as you light one torch.  that means the area around Link actually gets somewhat _darker_ when the rest of the room gets lighter.  this is dumb.  why should the Lamp/Lantern lose its perpetual burning ability just because you lit a torch?  the game's already docking you MP for said lighting, and it's possible you lit it with Fire Rod anyway.

the GBA version remedies this silliness by keeping the spotlight until slightly after you've lit 3 torches, and restoring it whenever the third goes out.

here is my pending attempt to do the same thing on SNES:

http://assassin17.brinkster.net/forum-posts/zelda-torches/torch-alpha1.zip

see contents-readme.txt for explanation of the files included.

applying both light-torch-new1.asm and torch-go-out-new1.asm will keep the original spotlight until you've lit 3 torches, and restore it whenever the third goes out.  however, it has an issue of a darkened ring around Link once two torches are lit, because it doesn't alter the perimeter of the spotlight as the room gets brighter.

the game achieves ambient room darkening/brightening and the lamp/lantern spotlight with color translucency math, specifically subtraction of a value ranging from 0 to 31.  if you turn off Transparency effects in Snes9x, you can see the black and dark gray spotlight on BG #1.  black has color components of zero value, so when it's subtracted from the room background, you keep full brightness, while subtracting gray makes it a little dimmer.  everything outside this spotlight overlay is subject to the room-wide color reducer, which is determined by different target values based on # of torches lit: 0 torches = 31, 1 = 8, 2 = 4, 3+ = 0 .  the reducer isn't immediately set to these values, but gradually adjusted to meet them.

finding the black and gray overlay in ROM and drawing a larger alternate would make a nice feature for a Super Lamp, btw.

i considered dealing with the darkened ring around Link by having alternate-colored overlays depending on the lit torch count, but this'd take a bit of extra ROM space.  also, it wouldn't match the GBA's nice behavior of having the outer edge of the spotlight change gradually in response to torch lighting/extinguishing, much as the rest of the room already does.

dynamically redrawing the gray pixels would be too slow and involved, so i went at it a third way: the outer spotlight's palette.  it's Palette 11h, and has default color component values of 6.  i modify it from an interrupt routine based on the ambient color reducer.  hopefully, entry 11h is always used for the spotlight, it has 6s everywhere it's used, and it's not used for anything else; otherwise, there'll be omissions and side effects.  the fact that 11h is outside the range of entries in the 7E/C500 palette table that get darkened then gradually lightened when you enter a room gives me some confidence that it's a special case and there won't be conflicts.

also, having my new code run 60 times a second in a speed-sensitive routine might cause issues, though it seems alright in Snes9x.  calling it this often does allow me to gradually alter the outer ring.

there are three versions of the palette adjuster included.

i welcome feedback on all files, and discussion of the optimal color adjustment.  it'd be damned cool to have a "master formula" based on the color reducer's distance from 31, as well as its distance from the default value of the region being altered.  but that might be too elusive to pin down, or too involved to code.  so individually deciding the result of all 32 input values is also an option.

even with the patch, the SNES version still gets rid of the overlay as soon as the 3rd torch is lit, so there'll be a few frames where the area around Link is darker than it was just before.  in contrast, the GBA gradually phases out the spotlight.  (i'm impressed by what they did on that version, even if the outer portion of the spotlight has that silly checkering.)  ways to match this might be keeping the overlay on all the time (a bit CPU-intensive), or creating a custom "overlay removal pending" variable (harder to code).

finally, help in making sense of Function 0D/FA33 and Variable $0458 would be appreciated.
avatar
assassin17
Witch
Witch

Since : 2015-03-14

http://assassin17.brinkster.net/

Back to top Go down

Re: Attempting on-more-often Lamp/Lantern

Post by wizzrobemaster on Thu 26 Jan 2017 - 8:28

I think what is interesting is that the Lantern has a hidden ability which does not make it obsolete unlike the Fire Rod.

wizzrobemaster
Crystal Maiden
Crystal Maiden

Since : 2015-01-04

Back to top Go down

Re: Attempting on-more-often Lamp/Lantern

Post by assassin17 on Sat 28 Jan 2017 - 0:40

since applying multiple .asm files can be a chore, added .IPS patches and anti-patches to .ZIP file.

----

EDIT: an off-by-one mistake on a free space address means you could never make it past the title screen!  that's what i get for testing only with savestates. Doh  updated .ZIP file with working patches.


Last edited by assassin17 on Mon 30 Jan 2017 - 5:47; edited 1 time in total (Reason for editing : no longer ruin the game)
avatar
assassin17
Witch
Witch

Since : 2015-03-14

http://assassin17.brinkster.net/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum