MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Sprite_OnScreen_Check

Method Sprite_OnScreen_Check

Source/PC/Graphics_PC.cpp:737–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735}
736
737bool cGraphics_PC::Sprite_OnScreen_Check() {
738 int16 ax;
739
740 if (mFodder->mVideo_Draw_PosY < 0) {
741 ax = mFodder->mVideo_Draw_PosY + mFodder->mVideo_Draw_Rows;
742 --ax;
743 if (ax < 0)
744 return false;
745
746 ax -= 0;
747 ax -= mFodder->mVideo_Draw_Rows;
748 ++ax;
749 ax = -ax;
750 mFodder->mVideo_Draw_PosY += ax;
751 mFodder->mVideo_Draw_Rows -= ax;
752
753 ax *= 0xA0;
754
755 mFodder->mVideo_Draw_FrameDataPtr += ax;
756 }
757
758 ax = mFodder->mVideo_Draw_PosY + mFodder->mVideo_Draw_Rows;
759 --ax;
760
761 auto maxHeight = g_Window->GetScreenSize().getHeight() + 31;
762 if (ax > maxHeight) {
763 if (mFodder->mVideo_Draw_PosY > maxHeight)
764 return false;
765
766 ax -= maxHeight;
767 mFodder->mVideo_Draw_Rows -= ax;
768 }
769
770 if (mFodder->mVideo_Draw_PosX < 0) {
771 ax = mFodder->mVideo_Draw_PosX + mFodder->mVideo_Draw_Columns;
772 --ax;
773 if (ax < 0)
774 return false;
775
776 ax -= mFodder->mVideo_Draw_Columns;
777 ++ax;
778 ax = -ax;
779 --ax;
780
781 mFodder->mVideo_Draw_PosX += ax;
782 mFodder->mVideo_Draw_Columns -= ax;
783 ax >>= 1;
784 mFodder->mVideo_Draw_FrameDataPtr += ax;
785 }
786
787 ax = mFodder->mVideo_Draw_PosX + mFodder->mVideo_Draw_Columns;
788 --ax;
789 int16 maxWindowX = mFodder->getWindowWidth() + 31; // 351
790
791 if (ax > maxWindowX) {
792 if (mFodder->mVideo_Draw_PosX > maxWindowX)
793 return false;
794

Callers

nothing calls this directly

Calls 3

getWindowWidthMethod · 0.80
getHeightMethod · 0.45
GetScreenSizeMethod · 0.45

Tested by

no test coverage detected