ZoriaRPG

Screen Intros for 2.55 for SkyLizardGirl

Mar 8th, 2019
150
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. script typedef ffc struct;
  2. script typedef ffc class;
  3.  
  4. stuct script locations
  5. {
  6.     enum{ curDMAP, curSCREEN, pvsDMAP, pvsSCREEN, locLAST};
  7.     int data[locLAST];
  8.     void run(){}
  9.     void clear() for ( int q = 0; q < locLAST; ++q ) data[q] = 0;
  10.     bool changed() { return ( Game->GetCurDMap() != data[curDMAP] || Game->GetCurScreen() != data[curSCREEN] ); }
  11.     bool dmapchanged() { return ( Game->GetCurDMap() != data[curDMAP] ); }
  12.     bool screenchanged() { return ( Game->GetCurScreen() != data[curSCREEN] ); }
  13.     int priorDMap() { return ( data[pvsDMAP] );
  14.     void update()
  15.     {
  16.         data[pvsSCREEN] = data[curSCREEN];
  17.         data[pvsDMAP] = data[curDMAP];
  18.         data[curSCREEN] = Game->GetCurScreen();
  19.         data[curDMAP] = Game->GetCurDMap();
  20.     }
  21.     void update_dmap()
  22.     {
  23.         data[pvsDMAP] = data[curDMAP];
  24.         data[curDMAP] = Game->GetCurDMap();
  25.     }
  26.     void update_screen()
  27.     {
  28.         data[pvsSCREEN] = data[curSCREEN];
  29.         data[curSCREEN] = Game->GetCurScreen();
  30.     }
  31.    
  32. }
  33.  
  34. class script screenintros
  35. {
  36.     const int REGISTER = 6;
  37.     const int BIT = 2;
  38.     void run(){}
  39.     void clear()
  40.     {
  41.         for ( int q = 0; q < 0x80; ++q )
  42.         {
  43.             SetScreenDBit(locations.data[pvsDMAP], q, REG, BIT, false);
  44.         }
  45.     }
  46.     void update()
  47.     {
  48.    
  49.         if ( locations.dmapchanged() )
  50.         {
  51.             locations.update_dmap();
  52.             clear(); /Re-display after changing dmaps, like DMap intros repeat, but for screens.
  53.         }
  54.     }
  55. }
  56.  
  57. link script active
  58. {
  59.     void run()
  60.     {
  61.         while(1)
  62.         {
  63.             screenintros.update();
  64.            
  65.             Waitframe();
  66.         }
  67.     }
  68. }
  69.  
  70. //Does not repeat if you revisit the screen, unless you change dmaps.
  71. ffc script screenmessage
  72. {
  73.  
  74.     const int REGISTER = 6;
  75.     const int BIT = 2;
  76.     const int DELAY_DEFAULT = 150;
  77.     void run(int msg, int delay, int reg )
  78.     {
  79.         reg = ( reg > 0 ) ? reg : REGISTER;
  80.         delay = ( delay > 0 ) ? delay : DELAY_DEFAULT;
  81.        
  82.         while(1)
  83.         {
  84.             if ( !(GetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), REG, BIT)); )
  85.             {
  86.                 Waitframes(delay);
  87.                 Screen->Message(msg);
  88.                 SetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), REG, BIT, true);
  89.             }
  90.             Waitframe();
  91.         }
  92.     }
  93. }
  94.  
  95. link script init
  96. {
  97.     void run()
  98.     {
  99.         locations.clear();
  100.         locations.clear(); //Call twice to push the previous screen down.
  101.     }
  102. }
RAW Paste Data