Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding compilation-time flag to disable all fixes for vanilla execution #239

Merged
merged 6 commits into from
Apr 18, 2021

Conversation

SergioMartin86
Copy link
Contributor

@SergioMartin86 SergioMartin86 commented Apr 14, 2021

Me and mooskagh are developing an automated tool to find the best strats for speedrunning. The recently added bug fixes are set by defines in config.h that cannot be disabled on runtime. These bugs might be useful for an any% run, though.

I propose adding this flag that allows us to disable all fixes at compilation time.

@SergioMartin86
Copy link
Contributor Author

Also fixing a bug with FIX_CORNER_GRAB. It was placed with ifdef twice. When I disabled the define, loose tiles wouldn't fall from the ceiling. See:

image

@NagyD NagyD merged commit c59177a into NagyD:master Apr 18, 2021
@NagyD
Copy link
Owner

NagyD commented Apr 18, 2021

A comment on 7d654bf:

I think that in the original PoP, the RNG cycle is wasted by the prandom(1000) a few lines below.
I had to comment it out in SDLPoP, because SDLPoP resamples all digi sounds to the output sample rate, and thus the sample rate of a sound cannot be changed on they fly anymore.

Unfortunately, your change can desynchronize replay files if a loose floor sound is played before a guard fight, because both use the same global RNG.
For an example, see the lvl 4 replay from here: https://www.popot.org/custom_levels.php?mod=0000111
So perhaps this addition should be in an #ifdef DISABLE_ALL_FIXES.

EDIT: Done: d98c398

NagyD added a commit that referenced this pull request Apr 18, 2021
@SergioMartin86
Copy link
Contributor Author

Thanks for merging and fixing this!

@mooskagh
Copy link

I think the "cleaner" (in a way to be more "correct" in future versions but not breaking replay files) would be to check the version of the replay file, and only skip that prandom() call if an old replay file is played.

Otherwise there will be discrepancy between DISABLE_ALL_FIXED replays and normal ones.

E.g. when I generated speedruns, I generated them with stripped version of SDLPoP, and then sent .p1r to other people to watch. This won't be possible anymore.

@NagyD
Copy link
Owner

NagyD commented Apr 24, 2021

I think the "cleaner" (in a way to be more "correct" in future versions but not breaking replay files) would be to check the version of the replay file,

Which field should I check? There is version_number, deprecation_number, and implementation_name.
Which one did you change in your .p1r files, and to what value?

@mooskagh
Copy link

I think the "cleaner" (in a way to be more "correct" in future versions but not breaking replay files) would be to check the version of the replay file,

Which field should I check? There is version_number, deprecation_number, and implementation_name.
Which one did you change in your .p1r files, and to what value?

I didn't change any value (all .p1r files I generated still used the old behaviour), but I think it's a good time to increment deprecation_number in new .p1r, and then check whether it's >=2 while replaying?

Another option that also sounds fine for me is to rollback the fixed logic completely, and then whoever wants exact behavior, can just apply the patch and recompile. But then I think a year from now someone won't know about that and will spend their time investigating inconsistency again..

@NagyD
Copy link
Owner

NagyD commented Apr 25, 2021

but I think it's a good time to increment deprecation_number in new .p1r, and then check whether it's >=2 while replaying?

Done: 9047166

(Mentioning @Falcury because he made most of the replay code. I should have done this earlier.)

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jul 21, 2021
Changelog:

2021 July 5
=================
(version 1.22)

FIXED: The prince can now grab a ledge at the bottom right corner of
       a room with no room below.
	Details: https://forum.princed.org/viewtopic.php?p=30410#p30410
	Testcase: doc/replays-testcases/SNES-PC-set level 11.p1r
	See FIX_CORNER_GRAB in config.h .
FIXED: Don't allow killing a skeleton in cheat mode.
FIXED: Ctrl+S didn't mute music (except death music).
FIXED: A falling tile on the left side of a pillar could cause the
       blue stripe to be drawn over the pillar.
FIXED: The top of moving gates became glitched on levels using
       non-default palettes.
FIXED: The right edge of pressed drop buttons was black if a big
       pillar was next to them.
FIXED: Guards appeared in the current room when they fell into spikes
       in an adjacent room. (Example: original level 11, room 22.)
FIXED: Show an error message if a data file is missing.
FIXED: "Remember guard hp" for non-standard guards.
FIXED: Colored torches were not restored on quickload if you (quit
       and) restarted the game after quicksave.
DONE: Added command-line parameter "mute": Start the game with sound off.
FIXED: Fixed compiling with some features #undefined. (USE_TEXT,
       USE_LIGHTING, USE_MENU)
DONE: Hide references to various features if the game was compiled
       without them.
DONE: A scrollbar appears in the pause menu if scrolling is possible.
	It's not clickable yet, it just shows where you are in the list.
DONE: Added command-line parameter "playdemo": Make the demo level
       playable.
FIXED: Fixed the detection of Ctrl+L during the demo level.
FIXED: Create the screenshots directory in SDLPoP's directory, even
       if the current directory is something else.
	This is to match how the replay folder works.
FIXED: On Windows, use Unicode/UTF-8 for mkdir().
	So the replay and screenshots directories can be created
        within non-ASCII paths.
FIXED: After quickload, show the room where the prince is, even if
       the player moved the view away from it (with the H,J,U,N keys).
FIXED: After quickload, don't draw guard HP if a previously viewed
       room (with the H,J,U,N keys) had a guard but the current room
       doesn't have one.
DONE: Speed up music, sounds, and transitions during fast forwarding.
FIXED: Prevent the modifier remapping from accessing out-of-range rooms.
FIXED: Don't show the mirror image if the prince is not in the
       currently shown room.
DONE: Added a new cheat key: Ctrl+B: Go back to the room where the
      prince is. (Undo H,J,U,N.)
FIXED: Fixed the length of feather fall in fast-forward mode.
FIXED: Prevent torches from being randomly colored when an older
       replay is loaded.
FIXED: If the prince is fighting a guard, and the player does a
       quickload to a state where the prince is near the mouse,
       the prince would draw the sword.
DONE: Added options for changing speeds. They are detected from
       PRINCE.EXE. (Used in Hurry up Prince, for example.)
DONE: In the settings menu, allow using Page Up, Page Down, Home, End.
FIXED: Fixed graphical glitches with an opening gate:
	1. with a loose floor above and a wall above-right.
	2. with the top half of a big pillar above-right.
	See FIX_ABOVE_GATE in config.h .
FIXED: Validate mode crashed with the error "init_scaling:
       SDL_CreateTexture: Invalid renderer".
DONE: Rewrote all mentions of key combinations to the "Ctrl+A" style.
DONE: Marked which features of SDLPoP are not in the original game.
      (To prevent confusions like #197)
DONE: Allow Backspace and Ctrl+C during replay.
DONE: During playback, display the number of ticks since start, if
      the timer is shown (debug cheats: T).
FIXED: Fixed crashing when a MIDI music interrupted another one.
FIXED: Make it possible to go through a certain closed gate on level 11
       of Demo by Suave Prince.
	Details: https://forum.princed.org/viewtopic.php?p=32326#p32326
	Testcase: doc/replays-testcases/Demo by Suave Prince level 11.p1r
	See FIX_COLL_FLAGS in config.h .
FIXED: When the prince jumps up at the bottom of a big pillar split
       between two rooms, a part near the top of the screen disappears.
	Example: The top row in the first room of the original level 5.
	Details: See FIX_BIGPILLAR_JUMP_UP in config.h .
DONE: Added a debug cheat to quickload but keep the currently loaded
      level. (Shift+F9)
	Motivation: https://forum.princed.org/viewtopic.php?p=32556#p32556
FIXED: Fixed spiked/chomped/bumped guards teleporting into the wrong room.
       (if fixes are enabled)
	Details: NagyD/SDLPoP#237
FIXED: Quicksave during feather fall mode. (if fixes are enabled)
	Details: NagyD/SDLPoP#236
FIXED: Prevent the prince from entering a glitched room when he falls
       into a wall or he is revived near a wall.
	Details: doc/replays-testcases/Original level 2 falling into wall.txt
	Testcase: doc/replays-testcases/Original level 2 falling into wall.p1r
	See FIX_ENTERING_GLITCHED_ROOMS in config.h .
FIXED: Optimized OPL mixing (MIDI music).
	Details: NagyD/SDLPoP#238
	"More importantly: when run on a Raspberry Pi Zero, the music went
        from unusable to perfect,"
FIXED: Fixed the prince sliding through closed gates when you are using
       the caped prince graphics.
	Details: See FIX_CAPED_PRINCE_SLIDING_THROUGH_GATE in config.h .
DONE: Added a compilation-time flag to disable all fixes for vanilla
      execution.
	Details: NagyD/SDLPoP#239
FIXED: If the prince dies on level 14, don't return to the intro after
       the level was restarted.
	Details: See FIX_LEVEL_14_RESTARTING in config.h .
DONE: Waste an RNG cycle in loose_shake() to match DOS PoP.
DONE: In new replays, use deprecation_number = 2. On playback, waste
      the RNG cycle only if deprecation_number >= 2.
	Older replays have deprecation_number <= 1, and we don't waste
	the RNG cycle when playing them back.
DONE: When backing offscreen (to the left) from the first guard on
      level 7 (among others), simulate the glitch from DOS PoP, which
      causes the prince to fall through the floor.
	Details: See NagyD/SDLPoP#229
FIXED: On Windows, use Unicode/UTF-8 for stat().
	So SDLPoP can load levels from mod folders when a replay file
	restarts the level or advances to the next level.
DONE: Added a more visible error message when a mod referenced by a
      replay file cannot be found in the mods folder.
DONE: Allow guard skill customizations in SDLPoP.ini.
DONE: Made FIX_DOORTOP_DISABLING_GUARD configurable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants