afritz1 / OpenTESArena

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

Castle graphic in Imperial City is incorrect #91

Closed Allofich closed 5 years ago

Allofich commented 6 years ago

The castle graphic in the Imperial City is incorrect.

opentesarena2 originalarena2 originalarena3

Allofich commented 6 years ago

You can see that in original Arena, the castle graphic is suspended in the air somewhat, and behind it there is 3d terrain.

I think the idea in the original is that if you don't get up so close to it, and I think maybe you can't in other cities, it creates an illusion that the 3d path leads up to the castle graphic. It might not work so well with the higher resolutions of OpenTESArena, of course.

afritz1 commented 6 years ago

I noticed this problem, too. They are transparent walls (type 0x9) in IMPERIAL.MIF, and it's currently loading them without any other changes (code), so Arena must be doing some extra work after the level is loaded to change them to something else (edge voxels maybe? Type 0xA?).

I'm not sure why it's suspended in the air. There must be some arbitrary offset Arena adds to it. Same thing with edge voxels (i.e., store signs). Without any changes, they are too close to the ground.

And yeah, I also figured that they were going for the "castle in the distance" illusion. The terrain behind the castle is not stored in IMPERIAL.MIF, so it's probably loaded from the wilderness (still need to look into that)

Carmina16 commented 6 years ago

There is quite a complicated algorithm I don't understand fully (I think it is intended to swap the halves of the palace when they are along to a certain map border), which seems to replace 9034 and 9035 with A5F5 and A5F4 after loading the map.

afritz1 commented 6 years ago

This is the first I've heard of any algorithm for modifying palace graphics. Even if there is a method to it, and even if it's used with all cities, it's still not completely correct, since I recall seeing some palace graphics in the original game that are incorrect like the first image above.

Carmina16 commented 6 years ago

What's getting replaced:

Wall  Grate Palace
-------------------
North A1B3  A5Bx (5-4)
West  A173  A57x (5/4)
East  A1F3  A5Fx (4/5)
South A133  A53x (4-5)
Carmina16 commented 6 years ago

I've found out what A block fields mean: A hhhs rrxx X

afritz1 commented 6 years ago

I've found out what A block fields mean

Thank you. Store signs and laundry now hang at the proper height in the Imperial City. See commit f1b9f6e5ea42118d83bb68811f578dffa63dfedb.

It appears that shifting the height bits right by 8 and dividing by 7.0 is the proper way to get the Y offset (I tried dividing by 8.0 but the signs were a bit too low).

afritz1 commented 5 years ago

This issue is more or less fixed now in commit ae392a6883eb4ce437d36079f83bd676ae32c3ed. Only thing left is to fix the reversed texture coordinates, but they're reversed because of changes I made so shop signs would always face the proper direction (i.e., so desert tavern signs wouldn't float in the air). I could potentially add a flipped boolean to all type 0xA voxels to fix this.

afritz1 commented 5 years ago

Palace graphics and gates are now correct in commit 3d9847653dc6f54282f3579aec8156821b35f7f1. I will handle the missing wilderness terrain in the future since that's a separate problem.