Skip to content

Commit 71e63a7

Browse files
authored
Fix negative X after left-edge sprite clipping (#122)
1 parent 85fca26 commit 71e63a7

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
@@ -695,6 +695,14 @@ bool cGraphics_PC::Sprite_OnScreen_Check() {
695695
mFodder->mVideo_Draw_Columns -= ax;
696696
ax >>= 1;
697697
mFodder->mVideo_Draw_FrameDataPtr += ax;
698+
699+
// Ensure the destination X never remains negative after clipping.
700+
// A remaining -1 here would underflow the destination pointer in Video_Draw_8.
701+
if (mFodder->mVideo_Draw_PosX < 0)
702+
{
703+
++mFodder->mVideo_Draw_PosX;
704+
--mFodder->mVideo_Draw_Columns;
705+
}
698706
}
699707

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

0 commit comments

Comments
 (0)