I think you should make a pull request from that.
Falcury wrote:I have attached a version of Norbert's test replay where I have truncated the size_t variables by four bytes using a hex editor (so it should work on 32-bit versions of SDLPoP).
I did the same with the two other replays from
https://github.com/NagyD/SDLPoP/issues/111
See attachment.
I could reproduce the bug with these.
And, I could reproduce the bug with a replay recorded by myself.
This could happen no matter how I start the recording: from the command line or after starting the level with Ctrl+Tab.
EDIT:
I added some debug printouts into prandom().
It seems that the saved random seed (that is in the P1R file) appears quite late in the output.
Both when recording and when replaying.
However, from that on the sequence seems identical...
Code: Select all
word __pascal far prandom(word max) {
printf("before: random_seed = %u\n", random_seed);
if (!seed_was_init) {
// init from current time
random_seed = time(NULL);
seed_was_init = 1;
}
printf("prandom(%d)\n", max);
random_seed = random_seed * 214013 + 2531011;
printf("after: random_seed = %u\n", random_seed);
return (random_seed >> 16) % (max + 1);
}
EDIT:
Hey, this is very odd...
The random seeds match in record and replay, but the distance in autocontrol_guard_kid_armed() is different!
Here, guard_advance() or guard_strike() might be called based on the value of distance.
And this leads to divergence...
I attached a modified source that prints out various debug info for comparison, and a sample replay with outputs.
The next question is obviously: Why is the distance different?
Maybe I was already pressing the right arrow while some music was playing, and music is not perfectly synced?