Loose floors bug

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.
Post Reply
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Loose floors bug

Post 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
Attachments
Mobs overflow 001.png
Mobs overflow 002.png
Mobs overflow 003.png
65536
4DPlayer

Re: Loose floors bug

Post 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.
User avatar
yourantumayel69
Calif
Calif
Posts: 565
Joined: November 12th, 2019, 9:53 am
Location: Indonesia
Contact:

Re: Loose floors bug

Post 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
Pengkhotbah 3:1 (TB) Untuk segala sesuatu ada masanya, untuk apa pun di bawah langit ada waktunya.
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: Loose floors bug

Post by Emiliano »

Sorry to disappoint you Youran :( , but 4D Player is not back at all, just read his signature
65536
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Loose floors bug

Post 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.
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: Loose floors bug

Post by Emiliano »

I didn't knew it was possible
65536
4DPlayer

Re: Loose floors bug

Post by 4DPlayer »

David always impresses with his knowledge :)
Post Reply