Skip to content

Conversation

@MontyTRC89
Copy link
Collaborator

This Pull request fixes many bugs with pathfinding of water creatures.
Additionally, I have cleaned a bit the code and added more comments;

@MontyTRC89 MontyTRC89 requested a review from Lwmte January 8, 2026 11:04
// =========================================================================================
// BOX FLAGS
// =========================================================================================
public bool Splitter; // Box is a "splitter" (1x1 box at TT_SPLITTER trigger)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is TT_SPLITTER? This terminology does not exist in TRLE.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SPLITTER is the gray box. Its true nature is to force the generation of 1x1 box that can be blocked or not by doors above them

// =========================================================================================
public bool Splitter; // Box is a "splitter" (1x1 box at TT_SPLITTER trigger)
public bool NotWalkableBox;// Box is marked as not walkable
public bool Monkey; // Box has monkey swing ceiling (TT_MONKEY trigger)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SPLITTER is the gray box. Its true nature is to force the generation of 1x1 box that can be blocked or not by doors above them

/// Used to detect slopes and calculate average floor height.
/// Naming: dec_tilt[1-4] corresponds to XnZp, XpZp, XpZn, XnZn corners.
/// </summary>
private int dec_tilt1 = Clicks.ToWorld(-1); // Floor.XnZp (X-, Z+)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion, this should be called not tilt but cornerHeight then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have used original names but i have correct it.

private List<TombEngineOverlap> dec_overlaps;
private bool dec_boxExtendsInAnotherRoom;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was it a mistake or dec_boxExtendsInAnotherRoom was renamed to dec_doorCheck unintentionally here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the original name, and it's the same thing: check door = box expansion continues in the room beyond the door,

/// <param name="z">World Z coordinate (in sectors)</param>
/// <returns>True if position is reachable, false if blocked</returns>
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
private bool Dec_ClampRoom(int x, int z)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was the reason for the rename? Old name (Dec_CanSectorBeReachedAndIsSolid) sounds more intuitive to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the original name

{
// Boxes must have the same height for jump
if (a.TrueFloor != b.TrueFloor) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please describe all changes done in this function further.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

/// Tests all sectors along the shared edge to ensure they connect properly.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public bool Dec_TestOverlapXmax(dec_TombEngine_box_aux test, dec_TombEngine_box_aux box)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please describe all changes done in this function further.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

/// Corresponds to TestLeftOverlap() in original box.c.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public bool Dec_TestOverlapXmin(dec_TombEngine_box_aux test, dec_TombEngine_box_aux box)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please describe all changes done in this function further.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

/// Corresponds to TestBottomOverlap() in original box.c (inverted axis).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public bool Dec_TestOverlapZmax(dec_TombEngine_box_aux test, dec_TombEngine_box_aux box)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please describe all changes done in this function further.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Dec_OverlapZmin(dec_TombEngine_box_aux a, dec_TombEngine_box_aux b)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please describe all changes done in this function further.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

@MontyTRC89 MontyTRC89 force-pushed the ai_pathfinding_fixes branch from 155425f to 6957349 Compare January 11, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants