Advertisement
ZoriaRPG

Scrollfix.zh

Jul 3rd, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. // Allows drawing tiles to correct position on Link when scrolling
  2. // Sets drawX/drawY either to Link X/Y when not scrolling, or the visual position when scrolling.
  3. // currently only used by Pegasus Boots (which is also setting drawX/drawY to Link's new x/y as he dashes)
  4.  
  5. void ScrollFix(){
  6.    //function by Saffith
  7.  
  8.    if(Link->Action==LA_SCROLLING){
  9.        if(scrollDir==-1)
  10.        {
  11.            if(Link->Y>160)
  12.            {
  13.                scrollDir=DIR_UP;
  14.                scrollCounter=45;
  15.            }
  16.            else if(Link->Y<0)
  17.            {
  18.                scrollDir=DIR_DOWN;
  19.                scrollCounter=45;
  20.            }
  21.            else if(Link->X>240)
  22.            {
  23.                scrollDir=DIR_LEFT;
  24.                scrollCounter=65;
  25.            }
  26.            else
  27.            {
  28.                scrollDir=DIR_RIGHT;
  29.                scrollCounter=65;
  30.            }
  31.        }
  32.    
  33.        if(scrollDir==DIR_UP && scrollCounter<45 && scrollCounter>4)
  34.            drawY+=4;
  35.        else if(scrollDir==DIR_DOWN && scrollCounter<45 && scrollCounter>4)
  36.            drawY-=4;
  37.        else if(scrollDir==DIR_LEFT && scrollCounter<65 && scrollCounter>4)
  38.            drawX+=4;
  39.        else if(scrollDir==DIR_RIGHT && scrollCounter<65 && scrollCounter>4)
  40.            drawX-=4;
  41.    
  42.        scrollCounter--;
  43.    }
  44.    else
  45.    {
  46.        drawX=Link->X;
  47.        drawY=Link->Y;
  48.        if(scrollDir!=-1)
  49.            scrollDir=-1;
  50.    }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement