SDLPoP; David's open-source port of PoP

Open-source port of PoP that runs natively on Windows, Linux, etc.
Post Reply
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

Norbert wrote:(PS: I don't understand what you mean by 640x480, for me it's just 320x200 and fullscreen doesn't scale up.)
I mean that the screen switches to 640×480, but only the center 320×200 is used.
As the documentation says:
If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: David's open-source port of PoP (pre-release)

Post by Norbert »

David wrote:
Norbert wrote:(PS: I don't understand what you mean by 640x480, for me it's just 320x200 and fullscreen doesn't scale up.)
I mean that the screen switches to 640×480, but only the center 320×200 is used.
As the documentation says:
If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background.
I still don't understand what you mean, because I don't see any of this under (my) Linux, but it's not important.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

Here is the new version.

Changes:
FIXED: If color 0 of a palette was not black, then it was not transparent.
FIXED: PNGs with alpha channel are drawn properly.
Attachments
PORT_PoP_v1.05.zip
(895.99 KiB) Downloaded 100 times
ikazrima
Efendi
Efendi
Posts: 12
Joined: February 21st, 2014, 6:01 am

Re: David's open-source port of PoP (pre-release)

Post by ikazrima »

This is very great! :)
I wonder if someone could provide some sort of documentation on how the gameplay works, like the one for the format specification. I would've, but sadly C is quite alien to me.
Andrew
Wise Scribe
Wise Scribe
Posts: 313
Joined: July 16th, 2009, 4:39 pm

Re: David's open-source port of PoP (pre-release)

Post by Andrew »

ikazrima wrote:I wonder if someone could provide some sort of documentation on how the gameplay works, like the one for the format specification. I would've, but sadly C is quite alien to me.
Are you looking for a complete explanation of the gameplay-related source code in plain English? That would be quite the undertaking! Perhaps you'll be able to make do with comments, which I'm sure David's adding plenty of to the disassembled C code?
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

sadly C is quite alien to me
Here you wrote you're using C#.
C# is similar to C, but perhaps not enough?

By the way, did you get the tiles to draw correctly?
The last time you posted, you had problems with that.

About documenting/explaining: Perhaps it would be enough to document some key things, like the sequence table.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

Remember the swordfight bug? (viewtopic.php?p=15185#p15185)
In parry() (at the end of seg005.c) there is this line:

Code: Select all

	if (opp_frame != 167) return;
Instead it should be this:

Code: Select all

	if (char_frame != 167) return;
(Of course this will be fixed in the next release.)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: David's open-source port of PoP (pre-release)

Post by Norbert »

David wrote:(Of course this will be fixed in the next release.)
Nice. That'll make playing mods a more pleasant and authentic experience, for sure.
The biggest hurdle still in place is the floating. It still feels weird to suddenly crash-land after drinking a floating potion. ;)
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

Here is the new version.

Changes:
FIXED: When fighting, parry-attack-parry-attack-... sequences stop when the guard attacks.
DONE: Sound timing (slow-fall and intro needs this)
DONE: Background color of texts in intro and ending
FIXED: prandom(): initialize from current time

Note: Sound timing is based on the length of speaker sounds.
Attachments
PORT_PoP_1.06.zip
(909.37 KiB) Downloaded 90 times
Eugene
Efendi
Efendi
Posts: 14
Joined: August 7th, 2014, 2:17 pm

Re: David's open-source port of PoP (pre-release)

Post by Eugene »

Hello. David.

About version 1.06
My system - Centos 7 64-bit.

I get a complete freeze of the program after some time.
Watch the video, please.
https://yadi.sk/i/Bpt2hZPZaNanE
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

I see the game hangs when the level door is opening.
Does this happen with all level doors and always?

This does not happen on Windows and I currently don't have Linux available.
Norbert (or anyone else using Linux), does this happen to you?

However, I found some mistakes (differences from the disassembly):
1. In animate_leveldoor(): (seg007.c)
This line:

Code: Select all

!(sound_flags & sfDigi) &&
Should be:

Code: Select all

(sound_flags & sfDigi) &&
-- though this is about the *closing* level door.
2. In play_speaker_sound(): (seg009.c)
Add this line at the top:

Code: Select all

speaker_sound_stop();
Please tell me whether these changes fix the problem.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: David's open-source port of PoP (pre-release)

Post by Norbert »

David wrote:Norbert (or anyone else using Linux), does this happen to you?
No, for me the game does not hang when the level door is opening.
Eugene
Efendi
Efendi
Posts: 14
Joined: August 7th, 2014, 2:17 pm

Re: David's open-source port of PoP (pre-release)

Post by Eugene »

David wrote:I see the game hangs when the level door is opening.
Does this happen with all level doors and always?
No.
Freezing does not occur every time.
I do not understand the regularity.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

Finally I could test this on Linux.
I could reproduce the bug many times.
It can hang at many places, not just when the exit door is opened.

It looks like idle() never reads the "timer stopped" event.
Probably because it is not generated, that is, the main timer does not call timer_callback().
(The timer is either stopped before completion or maybe not even started?)
So the call do_simple_wait(1); in play_level_2() never finishes.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: David's open-source port of PoP (pre-release)

Post by David »

I think I fixed it. I played the game from the beginning to the end under Linux, and it didn't hang.
The mysterious SDL_RemoveTimer errors also disappeared.

Here is the new version.

Changes:
FIXED: Under Linux, the game hanged randomly, because the main timer sometimes didn't generate its event.
FIXED: Removed the "Would play sound", "length =", "set_char_collision" and "Loading chtab" messages.
Those were annoying and possibly slowed the game down.
FIXED: Level 12: If I enter the last room while the music is still "playing", then the game does not advance to level 13.
And quits with error: Tried to load cutscene for level 26, not in 0..15
FIXED: Level 12->13 transition should not restore full HP or show level number.
FIXED: Displaying text is visibly slow on some systems.
Update only the affected area instead of the whole screen.
Attachments
PORT_PoP_v1.07.zip
(911.75 KiB) Downloaded 120 times
Post Reply