afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
988 stars 68 forks source link

Elden Grove garbage #89

Closed afritz1 closed 6 years ago

afritz1 commented 6 years ago

In the Elden Grove (accessible from the main menu by selecting 40852494.MIF and pressing 'F'), there are some garbage voxels at the bottom of the map. If they are rendered by the camera, it causes an out-of-bounds texture access and the game crashes. I'm not sure why there is garbage since this is the only main quest dungeon that has it, and its dimensions are correct (100x100), so perhaps there is some exception in the .MIF file's FLOR or MAP1 data that the program isn't checking for.

Elden Grove

Carmina16 commented 6 years ago

The garbage is there in the game too. Perhaps you should init all 64 texture slots to some valid default?

Debug tip: You can find the uncompressed level map at 0x10AE7 in SAVEGAME.0?, in the following order MAP1, FLOR, MAP2. It has a fixed 128x128 size.

afritz1 commented 6 years ago

That's a good idea. I tried to get to the bottom of the map in Arena but you can't use Passwall on hedges, so looking at the uncompressed save data seems like a better option.

One of the garbage voxels is a diagonal wall with texture ID 196. Perhaps Arena does a modulo to keep the texture indices between 0 and 63?

Edit: Adding a modulo to the voxel IDs seems to fix the problem. All of the textures indices lie within the proper range then.