New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWORD1: Implement palette fades #5293
Conversation
Also begin work on palette and sound fades
They can only be activated via the original debug keys ('1' and '4'), and only if ScummVM is launched in debug mode.
Had to reshuffle some stuff to make it work properly, and in order to set up everything for future changes.
Nice work! It would be better to keep PRs as targeted as possible, so it would be preferable to create separate PRs for the other major TODOs |
Thanks! I'll do as suggested then 馃檪 (within reason of course, some of those features are too much interconnected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! Have some remarks/questions
engines/sword1/screen.cpp
Outdated
if (_paletteFadeInfo.paletteCount == 0) { | ||
_paletteFadeInfo.paletteStatus = NO_FADE; | ||
} else { | ||
if (_paletteFadeInfo.paletteStatus == FADE_DOWN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, I am too picky, but I'd write something like:
for (int i = 0; i < 256 * 3; i++) {
if (_paletteFadeInfo.srcPalette[i] > 0 && (int8)_paletteFadeInfo.srcPalette[i] < (int8)_paletteFadeInfo.dstPalette[i])
_paletteFadeInfo.srcPalette[i] += _paletteFadeInfo.paletteStatus;
Since FADE_UP = 1
and FADE_DOWN = -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your way of writing this is certainly more concise and shorter; unfortunately I have tested it and it seems to break fades 馃檨 It appears the two conditions can't be used together.
If you are okay with it I'd leave the verbose code on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indeed can't work as when fading up from black, srcPalette will be 0 and fading will never happen.
Maybe CLIP could be used but it seems safer to keep it the way it's written here as there could be some wrapping (if we fade from white to black for example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Mac version of the game is known to use color 255 instead of 0 in some places, for example for the transparent color in parallax, or the background color visible in some screens, such as when opening the door in Nico's apartment.
And that recollection prompted me to test those places and find out that this pull request is actually breaking that and introducing a regression. When opening the door the color is now red instead of black:
By the way, while it seems to work I think the current code for the Mac version is probably not fully correct. I should take a look at the disassembly to check exactly what the original does.
Hi @criezy, thanks for the review! About the Mac concerns: tonight I can definitely help and pull up a disassembly as well to try and see what is actually supposed to happen in the cases the screen has to fade from and to black. |
Thanks for noting these issues! May I please ask for some savegames for those final sections? |
Savegame at the St Ninian's church: sword1.023.zip |
To answer my own question, the version from GOG has black bars there. So this appears to be a mac-specific issue (I must say I am not really surprised). |
This was a very nice catch, thanks! And this is one of those times in which I'm grateful to have the original scripts at hand... What is basically happening is that this ending scene is not a Smacker video but is instead a concatenation of (as they call them) "screens" functioning as camera angles. Normally when a screen is changed, a palette fade happens. But in this case, right before the sequence begins...
And it works! Kind of! There are no fades but the screen is dim as soon as a screen/palette change happens. Why? Because I forgot to left-shift the palette when a fade-cut was signaled to happen 馃檪 |
Do we have any video of someone playing this version on original hardware? I bet this could shed some light about whatever should happen in this case. |
Not that I know. But I have an old MacOS 9 laptop that still works so I can give it a go. I will probably have to play from the start as I doubt I still have savegames for the original. Not that I mind, but it will probably take a little while to reach that point which is unfortunately at the end of the game. |
Ah indeed. And that reminds of another "issue" that I forgot to mention because it is actually harmless. The colors that you have added to the |
Hopefully this can help, launch the game from command line like this:
where can be chosen from these ones . The main menu should appear if you already have savegames, in that case, just press restart. They do work on the dos executable. Edit, boot-param 73 seems to be matching your savegame! Edit 2: Darn, nevermind... I'm seeing from the disassembly that the only command line options are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This looks good to me now.
The remaining issue with the mac version is not a regression from this pull request and already occurs with the current code from master. So there is no reason to block this pull request because of it.
Thank you for the thorough review, I really appreciate it! 馃檹 |
Thank you! |
Ahoy! This is the first one of a series of changes and PRs which aim at finishing and implementing all those things from the original Broken Sword 1 executable which we are currently missing in our implementation. We have a great port of the engine and it would be a shame not to finish those last tasks; after all the devil is in the details 馃檪
A full list can be seen here: https://wiki.scummvm.org/index.php?title=Sword1
What am I looking at here?
In this first part I have implemented accurate palette fade-ins and fade-outs. In order to achieve this, one of the necessities was to fix the game timers, which was part of the to-do plan anyway.
Also, I implemented fast and slow modes from the original debug commands because at one point I was going insane debugging this 馃檪
All of this was implemented from the original code, using the DOS implementation as the reference (hence the usage of some kind of emulation of an vertical blank interrupt). Of course this is not the DOS code verbatim:
Let me know how is it. The moment this is merged, work will be resumed on all the other tasks mentioned on the wiki. Alternatively, if you prefer a bigger PR with more stuff poured into it, let me know.