Ok, been thinking. This is what I've got:
Code:
k0 = (cgraphics.p_current_background->h - SCREEN_DIMX)/SCROLL_RATE;
/* Add Background to the screen buffer */
if( k <= k0)
{
// Draw Background as normal
blit(cgraphics.p_current_background, cgraphics.p_screen_buffer1, 0, (int)(cgraphics.p_current_background->h - SCREEN_DIMY - (SCROLL_RATE*k)),0,0,
cgraphics.p_current_background->w, cgraphics.p_current_background->h);
}
if( k > k0)
{
// Draw bottom 1/2 of picture on top 1/2 of screen
blit(cgraphics.p_current_background, cgraphics.p_screen_buffer1, 0, (int)(cgraphics.p_current_background->h - (SCROLL_RATE*(k-k0))),0,0,
cgraphics.p_current_background->w, (k-k0)*SCROLL_RATE);
// Draw top 1/2 of picture on bottom 1/2 of screen
blit(cgraphics.p_current_background, cgraphics.p_screen_buffer1, 0, 0,0,(k-k0)*SCROLL_RATE,
cgraphics.p_current_background->w, SCREEN_DIMY - ((k-k0)*SCROLL_RATE));
// Reset k
if( k >= ((2*cgraphics.p_current_background->h/SCROLL_RATE) - k0 ) )
{
k = 0;
}
}
k0 is basically the 'critical value' for the scrolling stuff, which happens when the scrolling gets to the top of the page. ofcourse, at the end of game refresh part of the code, there is a line like 'k++;' so that the value of k changes. Problem is, it still doesnt give a very smooth 'swap over'.