Page 1 of 1

Loose floors bug

Posted: June 19th, 2020, 6:25 pm
by Emiliano
In some of my mods I found an interesting bug which I would like to fix because it's not comfortable pressing so many keys
If you put many loose floors on other loose floors or by triggering many loose floors, appears a message which says
Mobs Overflow
Press any Key to Continue

Re: Loose floors bug

Posted: June 20th, 2020, 8:46 pm
by 4DPlayer
Mobs Overflow is one of the overflow errors that will come as a result of too many objects on screen. The game displays this because it’s given the task of rendering a very large number of falling loose tiles in a little amount of time. Sometimes repeatedly pressing a key will continue the game by repeatedly dismissing the error so that you can hear the tiles falling but they aren’t displayed. When the tiles finish falling (although you don’t see them falling) the game will be released of the stress of all the objects and you can continue. In the case of the video above, it looks like the game altogether crashed because all the falling tiles was just too much to handle.

There is no way that I know of to fix it because the original PoP was built for DOS which just doesn’t have the power to render so many objects like that. This means the DOSBox emulator won’t have the power either. Perhaps SDLPoP was built in such a way that its engine can handle the stress of rendering all of the objects. You should try play testing the level on SDLPoP. I’m pretty sure it will work.

Re: Loose floors bug

Posted: June 21st, 2020, 5:14 am
by yourantumayel69
4DPlayer wrote: June 20th, 2020, 8:46 pm Mobs Overflow is one of the overflow errors that will come as a result of too many objects on screen. The game displays this because it’s given the task of rendering a very large number of falling loose tiles in a little amount of time. Sometimes repeatedly pressing a key will continue the game by repeatedly dismissing the error so that you can hear the tiles falling but they aren’t displayed. When the tiles finish falling (although you don’t see them falling) the game will be released of the stress of all the objects and you can continue. In the case of the video above, it looks like the game altogether crashed because all the falling tiles was just too much to handle.

There is no way that I know of to fix it because the original PoP was built for DOS which just doesn’t have the power to render so many objects like that. This means the DOSBox emulator won’t have the power either. Perhaps SDLPoP was built in such a way that its engine can handle the stress of rendering all of the objects. You should try play testing the level on SDLPoP. I’m pretty sure it will work.
Oh :o
Lambert/4DP, you come back :P

Re: Loose floors bug

Posted: June 21st, 2020, 5:17 am
by Emiliano
Sorry to disappoint you Youran :( , but 4D Player is not back at all, just read his signature

Re: Loose floors bug

Posted: June 21st, 2020, 1:57 pm
by David
Emiliano Fierro wrote: June 19th, 2020, 6:25 pm In some of my mods I found an interesting bug which I would like to fix because it's not comfortable pressing so many keys
If you put many loose floors on other loose floors or by triggering many loose floors, appears a message which says
Mobs Overflow
Press any Key to Continue
This error appears because PoP1 can handle only 14 falling loose floors at the same time.

In SDLPoP, we could change the numbers here:
https://github.com/NagyD/SDLPoP/blob/ma ... ata.h#L489 (array declaration)
https://github.com/NagyD/SDLPoP/blob/ma ... 007.c#L952 (overflow check)

In the original PoP, it's not this simple to change the limits.
If you just change the number in the overflow check, then the game will just overwrite whatever memory is after the Mobs table.
Some loose floors even disappear, because some of those memory areas are regularly zeroed. (They are used to mark tiles for redraw.)


So we need to find some unused area where we can put a bigger Mobs table.
The size of the WipeTable is 2100 bytes. (300 elements, of 7 bytes each.)
Palace walls use 7 elements per tile, so a room full of walls (see level 10) uses 30*7=210 elements.
This means we can use the rest, 2100-(210*7) = 630 bytes for the Mobs table.
The Mobs table uses 6 bytes per element, so we have space for 630/6 = 105 elements here. That's much more than 14!


First, reduce number in the WipeTable check to 210 = 0x00D2.

Search: A1 AE 42 89 46 FE 3D 2C 01
Change: 2C 01 to D2 00 (offset: 0xC732)

Then move the Mobs table from 0x4BB4 to its new place.
WipeTable is at 0x34D2.
The shortened WipeTable ends at: 0x34D2 + 0xD2 * 7 = 0x3A90.

Search: 05 B4 4B 50
Change: B4 4B to 90 3A
There are 8 occurrences. You need to replace all of them! (offsets: 0xAE35, 0xAE81, 0xAEA8, 0xAEDF, 0xAEEE, 0xB0F6, 0xB117, 0xB1C3)

The game also uses the offset 0x4BB4 + 3 = 0x4BB7.
We change it to: 0x3A90 + 3 = 0x3A93

Search: 80 BC B7 4B FF
Change: B7 4B to 93 3A (offset: 0xAED3)

Then increase the number in the Mobs check to 100 = 0x64.

Search: 83 3E 8C 40 0E 7C 09
Change: 0E to 64 (offset: 0xAE14)

That's all, now it should be possible to have more loose floors falling at the same time.

Re: Loose floors bug

Posted: June 21st, 2020, 3:17 pm
by Emiliano
I didn't knew it was possible

Re: Loose floors bug

Posted: June 21st, 2020, 3:56 pm
by 4DPlayer
David always impresses with his knowledge :)