SDLPoP; David's open-source port of PoP

Open-source port of PoP that runs natively on Windows, Linux, etc.
Eugene
Efendi
Efendi
Posts: 14
Joined: August 7th, 2014, 2:17 pm

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

Post by Eugene »

Apologies if this sounds dumb, but how about using something like FluidSynth, FMOD Ex, DUMB, BASS/BASSMIDI etc.? Then we can have (with something like BASSMIDI for example) support for MP3, MP2, MP1, OGG, WAV, AIFF, MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), MIDI (including SF2 and SFZ SoundFonts)... Of course I have no idea of the amount of effort involved, so it's easy for me to say, but I think MIDI and tracker module support especially would be nice so we can have good music at relatively small sizes.
I think this is non productive idea.
Now 13,5Mb size (ogg-files) are not so great.
And it size can even reduce, if you change the sample rate or bitrate.
And without much damage to the quality of the sound.
Andrew
Wise Scribe
Wise Scribe
Posts: 313
Joined: July 16th, 2009, 4:39 pm

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

Post by Andrew »

Eugene wrote:I think this is non productive idea.
Let's leave that to the actual guy working on it, shall we? I admit it might not at all be easy to implement, but for someone else to dismiss it outright makes no sense. Plus I'm not demanding it should be worked on now. There's no problem with placing it on the back-burner to be looked at once everything else is stable.
Humble_Prince
Scholar Scribe
Scholar Scribe
Posts: 1
Joined: March 4th, 2015, 11:45 pm

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

Post by Humble_Prince »

I don't know if this helps, but for anyone interested I am linking to to an OGG version of the Prince of Persia music that is only 2 MB in size. I have tested with the latest version of SDLPOP and works without issue. Thank you to the author of this great release. If it is useful perhaps you could release a version of your software with the music included? A zipped version of POP with music is now around 3.5 MB in size.


Kind regards,

http://www.filedropper.com/primceofpersiamusicoggvorbis

http://speedy.sh/54r2c/Primce-of-Persia ... Vorbis.zip
Falcury
Calif
Calif
Posts: 568
Joined: June 25th, 2009, 10:01 pm

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

Post by Falcury »

For fun and learning, I have started an attempt to modify the code so that it will work with SDL2. So far I've got the loading message displaying correctly (but not much more). Don't expect too much!
User avatar
kees
Efendi
Efendi
Posts: 6
Joined: April 26th, 2015, 7:25 am

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

Post by kees »

This is a great bit of code! I'd love to help contribute -- what's the best way to send patches? I have a few cleanups and some doc improvements. David, can you start a github branch? I'd really like to see Falcury's SDL2 work too.
User avatar
kees
Efendi
Efendi
Posts: 6
Joined: April 26th, 2015, 7:25 am

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

Post by kees »

I've been cleaning up fread/seek/etc stuff and other compiler warnings, and when I instrumented some of the silent errors, I encountered my newly added warnings at load time, and tracked down something I don't understand in load_pal_from_dat:
load_from_opendats_to_area(resource, area, 0, "pal");
The "0" there is "length", and load_from_opendats_to_area ends up loading 0 bytes from "pal" resources, like KID.DAT/res400.pal, which is 100 bytes but doesn't get loaded. It seems like "0" should actually be "sizeof(area)" instead?
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

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

Post by David »

* In the original game, load_from_opendats_to_area uses the size of the resource if length=0. This is a bad idea, because it can cause buffer overflow.
* You're right about sizeof(area).
* In the original game, load_pal_from_dat makes an "xlat table", something used for mapping color indexes from images to the screen.
This is not needed in SDLPoP, so you could remove it as well.
I already removed many references to these "xlat"s, but it seems I forgot this one.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

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

Post by David »

kees wrote:David, can you start a github branch?
I uploaded SDLPoP to GitHub: https://github.com/NagyD/SDLPoP
Falcury
Calif
Calif
Posts: 568
Joined: June 25th, 2009, 10:01 pm

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

Post by Falcury »

I have the SDL2 port mostly functional now, so here is my current state of work. I have also created a pull request for the GitHub repository.

Music, sounds and gameplay seem to be fully functional. I have changed the SDL window to display at 640x400 pixels by default. ALT+ENTER smoothly toggles fullscreen.

I have had to use some inefficient workarounds to get SDL2 to behave: images are now quite frequently temporarily converted to the onscreen surface format. This might cause the game to run slower. However, I think this can be fixed at some point.

One nagging issue is the guard HP drawing - moving to a room without a guard does not black out the guard hitpoints. I have a feeling it has to do with my changes to method_3_blit_mono(); I can get the guard hp to work correctly by disabling the SDL color key but it has side effects (black sections in the room tiles).
Attachments
SDLPoP_v1.14a_SDL2.zip
(1.46 MiB) Downloaded 240 times
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

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

Post by David »

Thank you!
I will take a look at your changes.
moving to a room without a guard does not black out the guard hitpoints
It also occurs when I hurt the guard.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

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

Post by David »

I think I fixed the hitpoint bug:
* In set_chtab_palette: (used for coloring the guards)

Code: Select all

- scolors[i].a = 0;
+ scolors[i].a = SDL_ALPHA_OPAQUE;
* In method_6_blit_img_to_scr:

Code: Select all

(in the else branch)
-        //SDL_SetSurfaceAlphaMod(colored_image, 0);
+        SDL_SetSurfaceAlphaMod(colored_image, 255);
Some more bugs that I found:
* shift,ctrl,alt,num,caps,scroll,... un-pause the game.
* If the game is paused, the screen is not redrawn (for example when I drag the window off-screen and back).
* Name entry does not work correctly. (hall of fame)
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

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

Post by salvadorc17 »

David wrote:
kees wrote:David, can you start a github branch?
I uploaded SDLPoP to GitHub: https://github.com/NagyD/SDLPoP

Wow this is so hard, code is native c??
User avatar
kees
Efendi
Efendi
Posts: 6
Joined: April 26th, 2015, 7:25 am

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

Post by kees »

David wrote:I uploaded SDLPoP to GitHub: https://github.com/NagyD/SDLPoP
Awesome!! I've forked and created a pull request for some Linux build updates.
User avatar
kees
Efendi
Efendi
Posts: 6
Joined: April 26th, 2015, 7:25 am

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

Post by kees »

salvadorc17 wrote:Wow this is so hard, code is native c??
Better than assembler! :D
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

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

Post by salvadorc17 »

Yes i know is better, but also some hard, i only manage to programming in c# like you can see in other post prince made in c#
Post Reply