Skip to content

[Fallout4] REFR Overrides are placed in wrong cell if X or Y position is exactly -n*4096.0 #1260

Description

@PJMail22

What is the version of xEdit you are using?
(all versions up to Fo4Edit 4.1.5a EXPERIMENTAL x64)
Describe the bug
xEdit does not calculate Cell coords correctly for References with an X or Y position that is negative and an exact multiple of 4096.
It assumes Cell coordinate is (position/4096)-1 for negative positions. This is incorrect.
wbIsInGridCell(GetPosition(ref),GetGridCell(LinksTo(ElementByIndex(ref, 0)))) also fails for such references.

To reproduce

  1. Pick a REFR that matches above - say 000DFAF5 in fallout4.esm
  2. create an override of it into a new esp
  3. look at the override - it is in a different cell.

Expected behavior
It should be in the same cell as the master reference. The creationKit places such references in the correct Cell.
xedittest1

xedittest2

Additional context
The correct calculation should be CellCoord = (position-0.001/4096)-1 for negative positions. The CK seems to ignore positional differences less than .001.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions