Castlevania II (Simon's Quest) - Multilingual enhancement

Started by Bisqwit, December 19, 2012, 01:38:36 PM

Previous topic - Next topic

helaku

Wow thank you for your answer ;D

About 3) to tell you the truth I always jump there without having the white crystal. So, my first interaction with the game and I discover this bug and the one with "Simon can jump up three-brick tall obstacles by using a weapon at the right time." (didn't discover the utilization of the red crystal at that moment). Very late in the game I discover the text with the utilization of the white crystal and the red crystal. First time I discover that trick with the platform I was confused because I was thinking that my game was broken until I select the white crystal and the platform appeared.  So, that's why I think it's a bug not a feature but it's just my point of view :)

About 4) it was interesting that you could add utilization to the ring to view the sacred flame in the woods like the scroll said (A FLAME FLICKERS INSIDE THE RING OF FIRE.) in the USA version. You cannot view the sacred flame with the eye but with the ring :) About the cross I think it's ok like you said because it have the utilization at the final stage; you cannot enter Dracula castle without it.
Have at you!

Bisqwit

The text "a flame flickers inside the ring of fire" is just a case of the USA translator being an idiot misunderstanding the meaning of the original text.

Here's my explanation from http://bisqwit.iki.fi/cv2fin/diff:

USA text: A FLAME   FLICKERS   INSIDE THE   RING OF   FIRE.
Original text:
セイナルホノオノ   ミナモトハ   ヒニトサ゛サレタ   リョウイキニ イマモ   ネムル
Context:
In Berkeley mansion. Hinted by string 80.
Meaning:
The source of the holy fire ("flame") sleeps even now in the land that is forever closed off (trapped) from daylight (in a territory that never sees sunlight).
Explanation:
In other words, the flame is hidden in a cave. Which is true. The English translator misunderstood the meaning, and tried to convey that the (a?) flame is trapped and surrounded by fire. The word ヒ, romanized "hi", can be read as both fire (火) and daylight (日). Unfortunately, this misunderstanding resulted in the text being completely incomprehensible in terms of gameplay.
My translation:
Even today the Sacred Flame rests in a realm hidden from sunlight.

To enter Dracula's castle, you actually need all the body parts including the ring, and the cross, and also the blue crystal. So the ring also has an utilization there according to the logic of your previous post. And naturally you need the holy water to break bricks in the floor.

helaku

About 5) if you say that it's the nature of the game to act like that when you use garlic then don't change it :) I always was thinking this was a bug not a limitation :)

About 1), and 2) it's sad that it's hard to be implemented but in my mind that's how it was supposed to be. The time to be stopped when you are in castles because of the curse and to pass when you are in houses and churches because there are no curse or evil sign/orb (like in some movies and games). About the doors the same thing: day are opened and night are closed. I don't know what the devs were thinking when they program it; it was like they were joking with this something like "hey vampire, come and suck my blood, i left the door open for you; kiss kiss"  :laugh:

Again, great work you did here!
Have at you!

Bregalad

QuoteAbout 1), and 2) it's sad that it's hard to be implemented but in my mind that's how it was supposed to be. The time to be stopped when you are in castles because of the curse and to pass when you are in houses and churches
Make absolutely no sense. The other way around would make sense, since you can enter dungeon anytime, including in night (it makes no difference), so no problem if there is a day->night or night->day transition in a dungeon, you just miss the notice of the transition.

In a house or church however, you'd need to be ejected when night happen since you cannot enter them during night. This de facto forbid time to advance in a house or church.

helaku

QuoteTo enter Dracula's castle, you actually need all the body parts including the ring, and the cross, and also the blue crystal. So the ring also has an utilization there according to the logic of your previous post. And naturally you need the holy water to break bricks in the floor.
By the way I've tested it now and you need the red crystal to pass the final bridge. It doesn't work if you have the blue crystal. Tested with: http://tasvideos.org/PasswordGenerators.html
So, the important items to end the game are Dracula parts, cross, red crystal and holly water (you can activate the bridge without the holly water but in Dracula castle you can't pass the floor).

QuoteMake absolutely no sense. The other way around would make sense, since you can enter dungeon anytime, including in night (it makes no difference), so no problem if there is a day->night or night->day transition in a dungeon, you just miss the notice of the transition.

In a house or church however, you'd need to be ejected when night happen since you cannot enter them during night. This de facto forbid time to advance in a house or church.
You don't understand what I want to explain Bregalad, maybe because English it's not my mother language.
But like in the horror movies or some games the time in vampire castles pass by differently like when you are outside because of the magic, power, barriers etc that exist in that castle.
Have at you!

Bisqwit

You are correct regarding the required crystal level. When I posted, I had the red and blue mixed up.

Version 2.9.8.17 released!
Changes include:
― Fixed the bug where Simon may become permanently invisible when he kills Dracula. Incidentally, now Dracula's death animation no longer hurts Simon (so you can't accidentally die after killing Dracula). This only affects the patch versions where Simon's blinking when hurt is enabled.
― Fixed the original game bug where you cannot create water bottles or daggers in certain situations where garlic is visible on screen. Incidentally, instead of saving just 4 bytes in the common bank, I ended up saving 21 19 after the bugfix reported below, more than the cost of the added function (18 bytes); just by rewriting the weapon-spawn code with some space-saving assembler tricks.
These changes affect all language versions.
― Finnish version only: Small prologue wording changes.
― Japanese version only: The title screens of VRAM versions are no longer broken.
― All VRAM versions: The version number string is no longer garbage in some versions.

Go and grab it at: http://bisqwit.iki.fi/cv2fin/

helaku

Wohoho ;D
Great Bisqwit ;D

P.S. I think but I'm not very sure this fix broken the sacred flame. I will test it more to see.
I used this cheat:
LOPZ VUBV
02JT T1AS
Can you test it Bisqwit?
I have 20 hearts and I can't use sacred flame...
By the way, oak stake can be used outside or only in castles?
Have at you!

Bisqwit

You are correct. The flame was broken. It consumed a random number of hearts. I have now fixed it (using the same version number). Just redownload the patch. Sorry about that.

EDIT: The oak stake can only be used in mansions. The game is hardcoded that way.

helaku

On final question: if I put 3 garlics on the floor (max you can put on the ground) I can't use any other item. If I put 2 garlics on the floor I can use only 1 item at time. It's normal this behavior?
Have at you!

Bisqwit

Quote from: helaku on April 26, 2015, 12:13:13 PMOn final question: if I put 3 garlic on the floor (max you can put on the ground) I can't use any other item. It's normal this behavior?
Yes, there's a total limit of 3 on-screen special weapon objects in the game. Mainly so that there's a reasonable upper limit to the number of collision checks the game has to do, each slowing the game.

helaku

Have at you!

Bisqwit

Since nobody downloaded any affected versions yet, I also added a few other changes to the most recent release that fix bugs in certain situations :-)

More information in the release announcement.

Regarding the doors-closing at night feature, here's the background tile indexes for the open door and the closed door:

Closed door:    Open door:
DE DF E0 E1     DE DF E0 E1
AD 77 AF 9D     AD 00 00 9D
94 78 7C 97     94 00 00 97
94 79 7D 97     94 00 00 97
94 78 7C 97     94 00 00 97
94 7B EF 97     94 F0 F0 97
AA 8E 8F AB     AA 8E 8F AB


Nintendulator's debugger was useful here. I would normally use FCEUX's here, but for some reason invoking FCEUX's debugger seems to crash Aero.



Basically we'd need some additional set of bytes in the level data, that would be interpreted to mean "00 00 00 00 00 00 00 00" at day and "77 78 79 7B 7C 7D AF EF" at night. Such as, "01 02 03 04 05 06 07 08". These would be replaced with the first table or the second table depending on hour. And when the hour changes, the screen background graphics would be refreshed as if the screen just scrolled.
Every open door in the town map data would need to be replaced with:
DE DF E0 E1
AD 01 07 9D
94 02 05 97
94 03 06 97
94 02 05 97
94 04 08 97
AA 8E 8F AB


So the list of changes needed would be:

1) Change level data to use different tile numbers for open doors.
Currently it suffices to know that if I put "AD 01 07 9D 94 02 05 97" at $85A9 and "94 03 06 97 04 02 05 97 94 04 08 97" at 86E1 in bank 4, I have accomplished this part, without knowing much else about the level data.

2) Change level-data reading routines to substitute these tile numbers depending on hour of day.
This requires understanding the routines that read the level data, which I don't (not fully at least). However, doing a search for "lda ($63),y" should find many relevant places, because $63 holds the pointer to the data that was modified in step #1. Furthermore, after some mathematics is applied to that pointer, $16 holds the pointer to the actual byte; so searching for "lda ($16),y" it is. The instruction at $F452 for instance loads the byte that is written when undoing the dialog box. $E54A loads the byte that is written when scrolling vertically. $E855 loads the byte that is written when scrolling horizontally or when restoring the screen. Changing all these to do the translation of the byte would be necessary, but I don't know if that's all that is required.
Basically, all these two-byte "lda ($16),y" instructions would need to be changed into this 16-byte code (+8-byte table):

  lda ($16),y ; original instruction, kept as is
  beq skip    ; cost so far: 3 cycles if $00, 2 cycles otherwise
  cmp #9      ; cost so far: 4 cycles
  bcs skip    ; cost so far: 7 cycles if >=$09, 6 otherwise
  tay         ; cost so far: 8 cycles
  lda IsNightTime ; cost so far: 11 cycles
  beq skip    ; cost so far: 14 cycles if day, 13 otherwise
  lda Table_NightDoor-1,y ; cost so far: 17 cycles
skip:
  ; cost so far: 3 cycles if $00, 7 cycles if not door, 14 cycles if day, 17 cycles if night
  ;continue as before
<somewhere else>
Table_NightDoor: $77,$78,$79,$7B,$7C,$7D,$AF,$EF

Which would add 3 to 17 cycles of extra cost for every single 8x8 tile rendering, assuming this code could fit in the space of those original 2 bytes. Because it can't, a JSR+RTS must be added, which adds an additional cost of 12 cycles. Thus, the cost of rendering a single column of 32 8x8 tiles when scrolling horizontally would be by average around 32*(12+11) = 736 cycles, which is quite a lot. It would make the already lag-prone game even laggier.

EDIT: After studying the surrounding code in each of those three locations, it seems that by rewriting the game's original code to use a small amount of sense, it's possible to add this town door thing and still come out a winner cycle-wise. This just leaves step #3...

3) Change the day-night transition such that it triggers a whole screen refresh. There is no such whole-screen refresh background job in the game, so it would have to be created. There's a whole-screen refresh that works while the screen is blanked and game paused (this is used when returning from sramsave/map screens, resuming from death, and when entering/exiting a door or new scene), but blanking the screen is exactly what we don't want here.
This is something that may go horribly wrong and require dozens of hours of iterative development and testing to get it right.

Turambar

Here is something that I always thought was strange...
Look at the doors in town. They have a bar across them on the outside of the door!
Meaning that somebody could actually bar/lock you inside your house from the outside.
Doors should only be barred/locked from the inside, not the outside.
Considering that, I figured the door graphics could be altered to remove the bar from them.
Plus, some of the door tiles are redundant, so the number of door tiles used can be reduced from 9 to 6.
Looking at the list of tiles in the PPU viewer, it seems like there are 7 black tiles.



Couldn't it be arranged so that only one black tile is used, for example 00?
There is probably lots of code and graphics that would need to be changed to accomplish that though.
If that could be done, then I figure that we could have enough space to actually double the door graphics.
I've colored coded the door graphics to help illustrate.
Here is how the tiles could look at night.




The open and closed doors could use tiles (76, 77, 78, 79 7A, 7B), (7C, 7D, AF, EF, F0, FF)
Then when it becomes daytime, you could simply draw over the actual tiles with black tiles, like this.




This would only have to happen during day/night transitions or when you first start the game.

Bisqwit

Quote from: Turambar on April 27, 2015, 12:41:11 AM
Here is something that I always thought was strange...
Look at the doors in town. They have a bar across them on the outside of the door!
Meaning that somebody could actually bar/lock you inside your house from the outside.
Doors should only be barred/locked from the inside, not the outside.
Heh, that's a graphics gaffe. Good sighting!

QuoteLooking at the list of tiles in the PPU viewer, it seems like there are 7 black tiles.
$60, $56 and $6C must be blank because they are a parts of 8x16 sprites (heart, water bottle and garlic respectively). Each of these doubles as both background graphics on status screen and graphics for a moving object.
$F0 and $FF must exist separately from $00 because the game uses the tile number to decide which attributes (solid, background etc.) to assign.
As for $76... I don't remember what's the excuse for that byte to exist separately from $00.
The game does also use the tile number to decide whether it's solid or intangible, but...

Quote
I like the door to have detail though...

Quote
Not sure what you are suggesting here. In the CHR-ROM version (i.e. the normal game) it is not possible to replace the CHR-ROM graphics while the game is running, except to swap a whole page for a completely another one.

Turambar

Quote from: Bisqwit on April 27, 2015, 03:33:15 AM
$60, $56 and $6C must be blank because they are a parts of 8x16 sprites (heart, water bottle and garlic respectively). Each of these doubles as both background graphics on status screen and graphics for a moving object.
Would it be possible to make those sprites be 8x8? Or change any of them so as to only need to use one blank tile?

Quote from: Bisqwit on April 27, 2015, 03:33:15 AMI like the door to have detail though...
Why wouldn't it have detail? The closed door is going to look the same as it normally does except missing the bar, and the open door is going to be black tiles.
As I said, I just colored coded it to show you which tiles on the PPU viewer would be used where.

Quote from: Bisqwit on April 27, 2015, 03:33:15 AMNot sure what you are suggesting here. In the CHR-ROM version (i.e. the normal game) it is not possible to replace the CHR-ROM graphics while the game is running, except to swap a whole page for a completely another one.
If none of that is possible then perhaps it would be possible to change some of the graphics to make room for 6 new door tiles on a particular bank.
I will play around with the graphics and see if changes can be made that make the game still look alright.
Is there an emulator that lets you easily edit tile graphics while the game is running? I remember that Nesticle let you do that, but that is an old, bad emulator.

Bisqwit

Quote from: Turambar on April 27, 2015, 05:08:16 AMWould it be possible to make those sprites be 8x8? Or change any of them so as to only need to use one blank tile?
No, not without major rewrites to the entire game. Either all sprites are 16x8 or all are 8x8. And when they are 16x8, they use two consecutive 8x8 tiles from the table.

QuoteThe closed door is going to look the same as it normally does except missing the bar, and the open door is going to be black tiles.
I suppose if normally closed doors are kept as is, and this graphics change is only included in night-shut doors, it's fine.
I have now tested this feature and it works (using the plan outlined in my previous long message), aside from missing step #3 (i.e. doors appear to change state only when the screen is refreshed either by scrolling, or exposing it from pause/transition).

Turambar

#856

Just for fun, I added in another set of door tiles.
Seems like room can indeed be made for them, but I'm not sure what we could do with them as far as opening and closing.

Bregalad

QuoteYou don't understand what I want to explain Bregalad, maybe because English it's not my mother language.
But like in the horror movies or some games the time in vampire castles pass by differently like when you are outside because of the magic, power, barriers etc that exist in that castle.
Nor is it mine's. I understood what you said, however, the time "stopping" in houses and dungeons is not related to a curse in any way (the entire region is cursed anyway, not just the dungeons), it is related to a technical limitation within the game, where day->night and night->day transition can only happen on the overworld.

Bisqwit

http://bisqwit.iki.fi/cv2fin/dev/towndoors_anim2.gif
Current development version.

Notice that when the first closed door appears, the graphics is partially open and partially closed. That's because the door was partially through the render redraw point of horizontal scrolling when the day changed into night, and the whole-screen refresher (step 3) is not created yet. It is updated fully closed as soon as a redraw is forced by drawing a status screen over it.

EDIT: Inline image changed into URL link because it kept seriously lagging Chrome when I left it open at background.

Turambar

Is the game noticeably laggier with this extra code?
I wonder if you could substitute metatiles instead of individual tiles and if that would be any faster.
For example, the metatiles for an open door are 0x14, 0x28 (top/bottom).
And the metatiles for a closed door are 0x20, 0x2B (top/bottom).
The offsets for the first church door are 0x85AA (0x14), 0x85B2 (0x28)