Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2738,10 +2738,16 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig)
static Bool doWobble = true;

if (m_disableRiver) return;

// TheSuperHackers @bugfix arcticdolphin 12/10/2026 Skip rivers that do not fit the 16 bit dynamic buffers.
const Int indexCount = (rectangleCount+1)*2*3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium Water/W3DWater.cpp:2743

Rivers with 21,846 points are skipped even though they generate only 65,532 indices, which fit in the 16-bit buffer. indexCount includes an extra quad, evaluates to 65,538, and triggers the early return; calculate it from the rectangleCount * 6 indices the loop writes.

Suggested change
const Int indexCount = (rectangleCount+1)*2*3;
const Int indexCount = rectangleCount*2*3;
🤖 Copy this AI Prompt to have your agent fix this:
In file @Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp around line 2743:

Rivers with 21,846 points are skipped even though they generate only 65,532 indices, which fit in the 16-bit buffer. `indexCount` includes an extra quad, evaluates to 65,538, and triggers the early return; calculate it from the `rectangleCount * 6` indices the loop writes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The check mirrors the count requested from DynamicIBAccessClass, which is what wraps.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The request should match the loop’s rectangleCount * 6 writes. At 21,846 points that is 65,532, which fits; the current extra six causes an unnecessary skip. Counts above that still return before the unsigned short constructor can wrap.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Matching the loop gains two points and makes a 3 point river lock zero indices.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You're right—the direct replacement would zero-lock a 3-point river. The count needs to retain a six-index minimum while using rectangleCount * 6 for nonzero rectangles.

if (indexCount > 65535)
return;

m_drawingRiver = true;

//allocate 2 triangles per side with 3 indices per triangle
DynamicIBAccessClass ib_access(BUFFER_TYPE_DYNAMIC_DX8,(rectangleCount+1)*2*3);
DynamicIBAccessClass ib_access(BUFFER_TYPE_DYNAMIC_DX8,indexCount);
{
DynamicIBAccessClass::WriteLockClass lockib(&ib_access);
UnsignedShort *curIb = lockib.Get_Index_Array();
Expand Down
Loading