Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

2 issues with Shatter's tileSize paramaters for importing/exporting segments + tileOrientation isn't applied to boxes from imported segments #31

Open
tm67602 opened this issue Nov 15, 2023 · 3 comments
Labels
help wanted Extra attention is needed wontfix This will not be worked on

Comments

@tm67602
Copy link

tm67602 commented Nov 15, 2023

I used the segment start0.xml.gz.mp3 from segments/holodeck to see whether the editor's tileSize parameters would translate correctly to the segment upon exporting, and it ultimately led to the discovery of multiple errors. The results are shown below.
Screenshot (356)

Issue 1: tileSize parameters are not always applied correctly when importing a segment
incorrect values
It appears the RightLeft, TopBottom, and FrontBack values were applied erroneously, as shown in the photo above. The top surface has now been stretched instead of the front, and the front surface is now a repeating texture. Changing the values manually revealed that the value for FrontBack had been applied to TopBottom instead.

Issue 2: RightLeft and FrontBack values are mislabeled/swapped in the editor
swap
When I manually applied the tileSize values, I found out the values are not labelled in the correct order, as the editor says the order of values is RightLeft, TopBottom, and FrontBack, but the output reveals the first value is for FrontBack and the third value is for RightLeft instead.

Issue 3: tileOrientation doesn't apply to imported segment boxes
Capture
When importing any segment, the tileOrientation value is automatically set to 0 0 0 for all boxes, but thankfully, manually changing it still works.

@knot126
Copy link
Contributor

knot126 commented Nov 16, 2023

It appears the RightLeft, TopBottom, and FrontBack values were applied erroneously, as shown in the photo above. The top surface has now been stretched instead of the front, and the front surface is now a repeating texture. Changing the values manually revealed that the value for FrontBack had been applied to TopBottom instead.

I've known about this for a long time and I honestly just think this segment is broken. If you look in the binary you will notice this help text for tileRot:

image

Which strongly implies that it's RightLeft (X) TopBottom (Y) FrontBack (Z) (at least, if I understand it as the axis on which to rotate). Now let's look at the segment:

	<box size="1.0 4.0 1.0" pos="0.0 -4.0 -7.0" hidden="0" template="holo_floor" tileSize="1 10 1"/>
	<box size="1.5 4.0 0.5" pos="-0.5 -4.0 -8.5" hidden="0" template="holo_floor" tileSize="1 10 1"/>
	<box size="0.5 4.0 0.5" pos="3.0 -4.0 -9.0" hidden="0" template="holo_floor" tileSize="1 10 1"/>
	<box size="2.5 4.0 0.5" pos="-0.5 -4.0 -9.5" hidden="0" template="holo_floor" tileSize="1 10 1"/>

So the segment has those properties set for TopBottom ... What the fuck? I've not been able to understand what's happening here so I've just let this bug stay since it seems to make no sense to me how this could work.

When I manually applied the tileSize values, I found out the values are not labelled in the correct order, as the editor says the order of values is RightLeft, TopBottom, and FrontBack, but the output reveals the first value is for FrontBack and the third value is for RightLeft instead.

I don't know what would have broken this or if it was ever correct but I'll look into that. At a glance the code looks right though:

if (obj.sh_properties.sh_tilesize[0] != 1.0 or obj.sh_properties.sh_tilesize[1] != 1.0 or obj.sh_properties.sh_tilesize[2] != 1.0):
properties["tileSize"] = exportList(obj.sh_properties.sh_tilesize)

When importing any segment, the tileOrientation value is automatically set to 0 0 0 for all boxes, but thankfully, manually changing it still works.

Again the code looks like it should be right but I could be wrong and I'll need to look into it.

b.sh_properties.sh_tilerot[i] = tileRot[min(i, tileRotLen - 1)] % 4 # HACK: ... so I'm doing this :)

However, I do want to point out that there are no tileRot's in this XML file. More likely this is the meshbaker getting the default rotations wrong.

I will admit that working with these rotations has been kind of a pain in the ass for me and I still don't understand exactly how it's supposed to work in Smash Hit due to these seemingly weird edge cases. Not helping is that I've forgotten 90% of how the meshbaking script I wrote works and that it sucks at doing rotations (and forget doing them properly) as well. :/

@tm67602
Copy link
Author

tm67602 commented Nov 16, 2023

I guess I should have figured that some of these issues was due to the segment itself and not the editor. On the bright side, at least implementing the values manually can act as a workaround, though it's going to be tedious since I wanted to modify the holodeck segments. (I'm currently making a mod using Shatter and that's how I kept finding all the bugs.) I'll see if the other holodeck segments have the same problem or not.

@knot126
Copy link
Contributor

knot126 commented Nov 16, 2023

Alright! I should probably implement some workaround for checkpoint 2 segments since that would be better than just leaving them completely broken. And I'll also leave this issue open with won't fix label since I still need to look at some things mentioned here.

@knot126 knot126 added help wanted Extra attention is needed wontfix This will not be worked on labels Nov 16, 2023
@knot126 knot126 pinned this issue Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants