Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. ffc script Switch_HitAll{
  2. void run(int switchCmb, int pressure, int perm, int id, int flag, int sfx, int switchID){
  3. bool noLink;
  4. if(pressure==2){
  5. pressure = 1;
  6. noLink = true;
  7. }
  8.  
  9. int i; int j; int k;
  10. int d;
  11. int db;
  12. if(flag==0)
  13. id = 0;
  14. int comboD[176];
  15. if(id>0){
  16. d = Floor((id-1)/16);
  17. db = 1<<((id-1)%16);
  18. for(i=0; i<176; ++i){
  19. if(Screen->ComboF[i]==flag){
  20. comboD[i] = Screen->ComboD[i];
  21. Screen->ComboF[i] = 0;
  22. }
  23. }
  24. }
  25. int switches[34];
  26. int switchD[34];
  27. int switchDB[34];
  28. switchD[0] = switchID;
  29. bool switchesPressed[34];
  30. k = SizeOfArray(switches)-2;
  31. for(i=0; i<176&&switches[0]<k; ++i){
  32. if(Screen->ComboD[i]==switchCmb){
  33. j = 2+switches[0];
  34. switches[j] = i;
  35. if(!pressure&&switchID>0){
  36. switchD[j] = Floor((switchID+switches[0]-1)/16);
  37. switchDB[j] = 1<<((switchID+switches[0]-1)%16);
  38. if(Screen->D[switchD[j]]&switchDB[j]){
  39. switchesPressed[j] = true;
  40. Screen->ComboD[i] = switchCmb+1;
  41. switches[1]++;
  42. }
  43. }
  44. switches[0]++;
  45. }
  46. }
  47. Waitframe();
  48. if(perm){
  49. if(id>0){
  50. if(Screen->D[d]&db){
  51. for(i=2; i<switches[0]+2; ++i){
  52. Screen->ComboD[switches[i]] = switchCmb+1;
  53. switchesPressed[i] = true;
  54. }
  55. for(i=0; i<176; ++i){
  56. if(comboD[i]>0){
  57. Screen->ComboD[i] = comboD[i]+1;
  58. }
  59. }
  60. while(true){
  61. Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
  62. Waitframe();
  63. }
  64. }
  65. }
  66. if(Screen->State[ST_SECRET]){
  67. for(i=2; i<switches[0]+2; ++i){
  68. Screen->ComboD[switches[i]] = switchCmb+1;
  69. switchesPressed[i] = true;
  70. }
  71. while(true){
  72. Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
  73. Waitframe();
  74. }
  75. }
  76. }
  77. if(pressure){
  78. while(switches[1]<switches[0]){
  79. Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, true, noLink);
  80. Waitframe();
  81. }
  82. if(id>0){
  83. if(sfx>0)
  84. Game->PlaySound(sfx);
  85. else
  86. Game->PlaySound(SFX_SECRET);
  87. for(i=0; i<176; ++i){
  88. if(comboD[i]>0){
  89. Screen->ComboD[i] = comboD[i]+1;
  90. }
  91. }
  92. }
  93. else{
  94. if(sfx>0)
  95. Game->PlaySound(sfx);
  96. else
  97. Game->PlaySound(SFX_SECRET);
  98. Screen->TriggerSecrets();
  99. }
  100. if(perm){
  101. if(id>0)
  102. Screen->D[d] |= db;
  103. else
  104. Screen->State[ST_SECRET] = true;
  105. }
  106. }
  107. else{
  108. while(switches[1]<switches[0]){
  109. Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
  110. Waitframe();
  111. }
  112. if(id>0){
  113. if(sfx>0)
  114. Game->PlaySound(sfx);
  115. else
  116. Game->PlaySound(SFX_SECRET);
  117. for(i=0; i<176; ++i){
  118. if(comboD[i]>0){
  119. Screen->ComboD[i] = comboD[i]+1;
  120. }
  121. }
  122. }
  123. else{
  124. if(sfx>0)
  125. Game->PlaySound(sfx);
  126. else
  127. Game->PlaySound(SFX_SECRET);
  128. Screen->TriggerSecrets();
  129. }
  130. if(perm){
  131. if(id>0)
  132. Screen->D[d] |= db;
  133. else
  134. Screen->State[ST_SECRET] = true;
  135. }
  136. }
  137. while(true){
  138. Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
  139. Waitframe();
  140. }
  141. }
  142. void Switches_Update(int switches, int switchD, int switchDB, bool switchesPressed, int switchCmb, bool pressure, bool noLink){
  143. if(pressure)
  144. switches[1] = 0;
  145. for(int i=0; i<switches[0]; ++i){
  146. int j = i+2;
  147. int k = switches[j];
  148. int p = Switch_Pressed(ComboX(k), ComboY(k), noLink);
  149. if(p){
  150. if(p!=2)
  151. Screen->ComboD[k] = switchCmb+1;
  152. if(!switchesPressed[j]){
  153. if ( !noLink )
  154. Game->PlaySound(SFX_SWITCH_PRESS);
  155. if(switchD[0]>0){
  156. Screen->D[switchD[j]] |= switchDB[j];
  157. }
  158. switchesPressed[j] = true;
  159. if(!pressure)
  160. switches[1]++;
  161. }
  162. if(pressure)
  163. switches[1]++;
  164. }
  165. else{
  166. if(switchesPressed[j]){
  167. if(pressure){
  168. if ( !noLink )
  169. Game->PlaySound(SFX_SWITCH_RELEASE);
  170. Screen->ComboD[k] = switchCmb;
  171. switchesPressed[j] = false;
  172. }
  173. else{
  174. if(Screen->ComboD[k]!=switchCmb+1)
  175. Screen->ComboD[k] = switchCmb+1;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement