Skip to content

Update VoxelIndexKey #42

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: phobos-dev
Choose a base branch
from

Conversation

CrimRecya
Copy link

No description provided.

@CrimRecya
Copy link
Author

For #1767 use.

@Metadorius Metadorius requested a review from secsome July 12, 2025 19:25
@@ -302,27 +302,20 @@ struct VoxelCacheStruct

struct MainVoxelIndexKey
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MainVoxelIndexKey related stuffs are called at UnitClass::Draw_As_VXL. At 0x73B5CB. pThisUnit->Locomotion->Draw_Matrix does the very beginning process. And the layout seems to be related with the specific loco.

All later usage of this index validates the key value to see if it -1, JumpjetLocomotionClass and HoverLocomotionClass forced it to be uncached if the FootClass object is rotated very hard. DriveLocomotionClass and ShipLocomotionClass filled the first 6 bits with current RampType. What is special is FlyLocomotionClass, which seems quite different from the other locos.

My guess is that FlyLocomotionClass use a unique index key calc system, JumpjetLocomotionClass and HoverLocomotionClass share the same calc system, DriveLocomotionClass and ShipLocomotionClass share the 6 bits holding for Ramp. And the others falls back to default base LocomotionClass type.

You may have to check it again, and find out the corresponding relationship between those locos and the indexkeys

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what you mean is: I need to write the special VoxelIndexKey for FlyLoco and RocketLoco, and which bits of MainVoxelIndexKey will be used in which places and under which circumstances, right?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what exactly should we do but Im pretty sure that Westwood didn't think too much on the index, they simply do bitshifts to make sure they are different (They don't care the exact bitfields layout). If we want to find out the exact meaning of each of them, then a "union" has to be used for different Locos.

Another solution is that we simply do what Westwood does, leave it as a int and don't care what the hell does it means exactly, as long as the index cannot be the same.

Maybe we should have a vote on this thing I guess

Copy link

@secsome secsome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment at line 303

@secsome
Copy link

secsome commented Jul 15, 2025

@Metadorius Maybe you should find some time and decide which impl should be used

@CrimRecya CrimRecya requested a review from Metadorius July 25, 2025 12:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants