Advertisement
Jhynjhiruu

Untitled

Apr 11th, 2019
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.54 KB | None | 0 0
  1.  
  2. int position;
  3.  
  4. void randomise_pipe_0(void)
  5. {
  6.    
  7.     position = rand() & 0x03;
  8.        
  9.     switch(position)
  10.     {
  11.         case 0x00:
  12.             PIPE_0_0.tile = PIPE_SECTION;
  13.             PIPE_0_1.tile = PIPE_SECTION;
  14.             PIPE_0_2.tile = PIPE_SECTION;
  15.             PIPE_0_3.tile = PIPE_END;
  16.             PIPE_0_4.tile = PIPE_SECTION;
  17.             PIPE_0_5.tile = PIPE_END;
  18.            
  19.             PIPE_0_0.ctrl = OAM_ENABLE;
  20.             PIPE_0_1.ctrl = OAM_ENABLE;
  21.             PIPE_0_2.ctrl = OAM_ENABLE;
  22.             PIPE_0_3.ctrl = OAM_ENABLE|OAM_FLIPH;
  23.             PIPE_0_4.ctrl = 0x00;
  24.             PIPE_0_5.ctrl = OAM_ENABLE;
  25.             break;
  26.        
  27.         case 0x01:
  28.             PIPE_0_0.tile = PIPE_SECTION;
  29.             PIPE_0_1.tile = PIPE_SECTION;
  30.             PIPE_0_2.tile = PIPE_END;
  31.             PIPE_0_3.tile = PIPE_SECTION;
  32.             PIPE_0_4.tile = PIPE_END;
  33.             PIPE_0_5.tile = PIPE_SECTION;
  34.            
  35.             PIPE_0_0.ctrl = OAM_ENABLE;
  36.             PIPE_0_1.ctrl = OAM_ENABLE;
  37.             PIPE_0_2.ctrl = OAM_ENABLE|OAM_FLIPH;
  38.             PIPE_0_3.ctrl = 0x00;
  39.             PIPE_0_4.ctrl = OAM_ENABLE;
  40.             PIPE_0_5.ctrl = OAM_ENABLE;
  41.             break;
  42.        
  43.         case 0x02:
  44.             PIPE_0_0.tile = PIPE_SECTION;
  45.             PIPE_0_1.tile = PIPE_END;
  46.             PIPE_0_2.tile = PIPE_SECTION;
  47.             PIPE_0_3.tile = PIPE_END;
  48.             PIPE_0_4.tile = PIPE_SECTION;
  49.             PIPE_0_5.tile = PIPE_SECTION;
  50.            
  51.             PIPE_0_0.ctrl = OAM_ENABLE;
  52.             PIPE_0_1.ctrl = OAM_ENABLE|OAM_FLIPH;
  53.             PIPE_0_2.ctrl = 0x00;
  54.             PIPE_0_3.ctrl = OAM_ENABLE;
  55.             PIPE_0_4.ctrl = OAM_ENABLE;
  56.             PIPE_0_5.ctrl = OAM_ENABLE;
  57.             break; 
  58.        
  59.         case 0x03:
  60.             PIPE_0_0.tile = PIPE_END;
  61.             PIPE_0_1.tile = PIPE_SECTION;
  62.             PIPE_0_2.tile = PIPE_END;
  63.             PIPE_0_3.tile = PIPE_SECTION;
  64.             PIPE_0_4.tile = PIPE_SECTION;
  65.             PIPE_0_5.tile = PIPE_SECTION;
  66.            
  67.             PIPE_0_0.ctrl = OAM_ENABLE|OAM_FLIPH;
  68.             PIPE_0_1.ctrl = 0x00;
  69.             PIPE_0_2.ctrl = OAM_ENABLE;
  70.             PIPE_0_3.ctrl = OAM_ENABLE;
  71.             PIPE_0_4.ctrl = OAM_ENABLE;
  72.             PIPE_0_5.ctrl = OAM_ENABLE;
  73.             break; 
  74.     }
  75.    
  76. }
  77.  
  78. void randomise_pipe_1(void)
  79. {
  80.    
  81.     position = rand() & 0x03;
  82.        
  83.     switch(position)
  84.     {
  85.         case 0x00:
  86.             PIPE_1_0.tile = BIRD_TILE_0;
  87.             PIPE_1_1.tile = PIPE_SECTION;
  88.             PIPE_1_2.tile = PIPE_SECTION;
  89.             PIPE_1_3.tile = PIPE_END;
  90.             PIPE_1_4.tile = PIPE_SECTION;
  91.             PIPE_1_5.tile = PIPE_END;
  92.            
  93.             PIPE_1_0.ctrl = OAM_ENABLE;
  94.             PIPE_1_1.ctrl = OAM_ENABLE;
  95.             PIPE_1_2.ctrl = OAM_ENABLE;
  96.             PIPE_1_3.ctrl = OAM_ENABLE|OAM_FLIPH;
  97.             PIPE_1_4.ctrl = 0x00;
  98.             PIPE_1_5.ctrl = OAM_ENABLE;
  99.             break;
  100.        
  101.         case 0x01:
  102.             PIPE_1_0.tile = BIRD_TILE_0;
  103.             PIPE_1_1.tile = PIPE_SECTION;
  104.             PIPE_1_2.tile = PIPE_END;
  105.             PIPE_1_3.tile = PIPE_SECTION;
  106.             PIPE_1_4.tile = PIPE_END;
  107.             PIPE_1_5.tile = PIPE_SECTION;
  108.            
  109.             PIPE_1_0.ctrl = OAM_ENABLE;
  110.             PIPE_1_1.ctrl = OAM_ENABLE;
  111.             PIPE_1_2.ctrl = OAM_ENABLE|OAM_FLIPH;
  112.             PIPE_1_3.ctrl = 0x00;
  113.             PIPE_1_4.ctrl = OAM_ENABLE;
  114.             PIPE_1_5.ctrl = OAM_ENABLE;
  115.             break;
  116.        
  117.         case 0x02:
  118.             PIPE_1_0.tile = BIRD_TILE_0;
  119.             PIPE_1_1.tile = PIPE_END;
  120.             PIPE_1_2.tile = PIPE_SECTION;
  121.             PIPE_1_3.tile = PIPE_END;
  122.             PIPE_1_4.tile = PIPE_SECTION;
  123.             PIPE_1_5.tile = PIPE_SECTION;
  124.            
  125.             PIPE_1_0.ctrl = OAM_ENABLE;
  126.             PIPE_1_1.ctrl = OAM_ENABLE|OAM_FLIPH;
  127.             PIPE_1_2.ctrl = 0x00;
  128.             PIPE_1_3.ctrl = OAM_ENABLE;
  129.             PIPE_1_4.ctrl = OAM_ENABLE;
  130.             PIPE_1_5.ctrl = OAM_ENABLE;
  131.             break; 
  132.        
  133.         case 0x03:
  134.             PIPE_1_0.tile = PIPE_END;
  135.             PIPE_1_1.tile = BIRD_TILE_0;
  136.             PIPE_1_2.tile = PIPE_END;
  137.             PIPE_1_3.tile = PIPE_SECTION;
  138.             PIPE_1_4.tile = PIPE_SECTION;
  139.             PIPE_1_5.tile = PIPE_SECTION;
  140.            
  141.             PIPE_1_0.ctrl = OAM_ENABLE|OAM_FLIPH;
  142.             PIPE_1_1.ctrl = 0x00;
  143.             PIPE_1_2.ctrl = OAM_ENABLE;
  144.             PIPE_1_3.ctrl = OAM_ENABLE;
  145.             PIPE_1_4.ctrl = OAM_ENABLE;
  146.             PIPE_1_5.ctrl = OAM_ENABLE;
  147.             break; 
  148.     }
  149.    
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement