MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GUI_Screen_FadeIn2

Function GUI_Screen_FadeIn2

src/gui/gui.c:3820–3891  ·  view source on GitHub ↗

* Fade in parts of the screen from one screenbuffer to the other screenbuffer. * @param x The X-position in the source and destination screenbuffers. * @param y The Y-position in the source and destination screenbuffers. * @param width The width of the screen to copy. * @param height The height of the screen to copy. * @param screenSrc The ID of the source screen. * @param screenDst The ID o

Source from the content-addressed store, hash-verified

3818 * @param skipNull Wether to copy pixels with colour 0.
3819 */
3820void GUI_Screen_FadeIn2(int16 x, int16 y, int16 width, int16 height, Screen screenSrc, Screen screenDst, uint16 delay, bool skipNull)
3821{
3822 Screen oldScreenID;
3823 uint16 i;
3824 uint16 j;
3825
3826 uint16 columns[SCREEN_WIDTH];
3827 uint16 rows[SCREEN_HEIGHT];
3828
3829 assert(width <= SCREEN_WIDTH);
3830 assert(height <= SCREEN_HEIGHT);
3831
3832 if (screenDst == 0) {
3833 GUI_Mouse_Hide_InRegion(x, y, x + width, y + height);
3834 }
3835
3836 for (i = 0; i < width; i++) columns[i] = i;
3837 for (i = 0; i < height; i++) rows[i] = i;
3838
3839 for (i = 0; i < width; i++) {
3840 uint16 tmp;
3841
3842 j = Tools_RandomLCG_Range(0, width - 1);
3843
3844 tmp = columns[j];
3845 columns[j] = columns[i];
3846 columns[i] = tmp;
3847 }
3848
3849 for (i = 0; i < height; i++) {
3850 uint16 tmp;
3851
3852 j = Tools_RandomLCG_Range(0, height - 1);
3853
3854 tmp = rows[j];
3855 rows[j] = rows[i];
3856 rows[i] = tmp;
3857 }
3858
3859 oldScreenID = GFX_Screen_SetActive(screenDst);
3860
3861 for (j = 0; j < height; j++) {
3862 uint16 j2 = j;
3863
3864 for (i = 0; i < width; i++) {
3865 uint8 colour;
3866 uint16 curX = x + columns[i];
3867 uint16 curY = y + rows[j2];
3868
3869 if (++j2 >= height) j2 = 0;
3870
3871 GFX_Screen_SetActive(screenSrc);
3872
3873 colour = GFX_GetPixel(curX, curY);
3874
3875 GFX_Screen_SetActive(screenDst);
3876
3877 if (skipNull && colour == 0) continue;

Callers 4

GameLoop_PlayAnimationFunction · 0.85
GameLoop_GameCreditsFunction · 0.85
GUI_StrategicMap_ShowFunction · 0.85

Calls 8

GUI_Mouse_Hide_InRegionFunction · 0.85
Tools_RandomLCG_RangeFunction · 0.85
GFX_Screen_SetActiveFunction · 0.85
GFX_GetPixelFunction · 0.85
GFX_PutPixelFunction · 0.85
GFX_Screen_SetDirtyFunction · 0.85
Timer_SleepFunction · 0.85
GUI_Mouse_Show_InRegionFunction · 0.85

Tested by

no test coverage detected