Skip to content

Commit 025fba8

Browse files
committed
Fix negative X after left-edge sprite clipping
1 parent 24aa8e7 commit 025fba8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Source/PC/Graphics_PC.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,14 @@ bool cGraphics_PC::Sprite_OnScreen_Check() {
694694
mFodder->mVideo_Draw_Columns -= ax;
695695
ax >>= 1;
696696
mFodder->mVideo_Draw_FrameDataPtr += ax;
697+
698+
// Ensure the destination X never remains negative after clipping.
699+
// A remaining -1 here would underflow the destination pointer in Video_Draw_8.
700+
if (mFodder->mVideo_Draw_PosX < 0)
701+
{
702+
++mFodder->mVideo_Draw_PosX;
703+
--mFodder->mVideo_Draw_Columns;
704+
}
697705
}
698706

699707
ax = mFodder->mVideo_Draw_PosX + mFodder->mVideo_Draw_Columns;

0 commit comments

Comments
 (0)