Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ffc script Switch_HitAll{
- void run(int switchCmb, int pressure, int perm, int id, int flag, int sfx, int switchID){
- bool noLink;
- if(pressure==2){
- pressure = 1;
- noLink = true;
- }
- int i; int j; int k;
- int d;
- int db;
- if(flag==0)
- id = 0;
- int comboD[176];
- if(id>0){
- d = Floor((id-1)/16);
- db = 1<<((id-1)%16);
- for(i=0; i<176; ++i){
- if(Screen->ComboF[i]==flag){
- comboD[i] = Screen->ComboD[i];
- Screen->ComboF[i] = 0;
- }
- }
- }
- int switches[34];
- int switchD[34];
- int switchDB[34];
- switchD[0] = switchID;
- bool switchesPressed[34];
- k = SizeOfArray(switches)-2;
- for(i=0; i<176&&switches[0]<k; ++i){
- if(Screen->ComboD[i]==switchCmb){
- j = 2+switches[0];
- switches[j] = i;
- if(!pressure&&switchID>0){
- switchD[j] = Floor((switchID+switches[0]-1)/16);
- switchDB[j] = 1<<((switchID+switches[0]-1)%16);
- if(Screen->D[switchD[j]]&switchDB[j]){
- switchesPressed[j] = true;
- Screen->ComboD[i] = switchCmb+1;
- switches[1]++;
- }
- }
- switches[0]++;
- }
- }
- Waitframe();
- if(perm){
- if(id>0){
- if(Screen->D[d]&db){
- for(i=2; i<switches[0]+2; ++i){
- Screen->ComboD[switches[i]] = switchCmb+1;
- switchesPressed[i] = true;
- }
- for(i=0; i<176; ++i){
- if(comboD[i]>0){
- Screen->ComboD[i] = comboD[i]+1;
- }
- }
- while(true){
- Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
- Waitframe();
- }
- }
- }
- if(Screen->State[ST_SECRET]){
- for(i=2; i<switches[0]+2; ++i){
- Screen->ComboD[switches[i]] = switchCmb+1;
- switchesPressed[i] = true;
- }
- while(true){
- Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
- Waitframe();
- }
- }
- }
- if(pressure){
- while(switches[1]<switches[0]){
- Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, true, noLink);
- Waitframe();
- }
- if(id>0){
- if(sfx>0)
- Game->PlaySound(sfx);
- else
- Game->PlaySound(SFX_SECRET);
- for(i=0; i<176; ++i){
- if(comboD[i]>0){
- Screen->ComboD[i] = comboD[i]+1;
- }
- }
- }
- else{
- if(sfx>0)
- Game->PlaySound(sfx);
- else
- Game->PlaySound(SFX_SECRET);
- Screen->TriggerSecrets();
- }
- if(perm){
- if(id>0)
- Screen->D[d] |= db;
- else
- Screen->State[ST_SECRET] = true;
- }
- }
- else{
- while(switches[1]<switches[0]){
- Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
- Waitframe();
- }
- if(id>0){
- if(sfx>0)
- Game->PlaySound(sfx);
- else
- Game->PlaySound(SFX_SECRET);
- for(i=0; i<176; ++i){
- if(comboD[i]>0){
- Screen->ComboD[i] = comboD[i]+1;
- }
- }
- }
- else{
- if(sfx>0)
- Game->PlaySound(sfx);
- else
- Game->PlaySound(SFX_SECRET);
- Screen->TriggerSecrets();
- }
- if(perm){
- if(id>0)
- Screen->D[d] |= db;
- else
- Screen->State[ST_SECRET] = true;
- }
- }
- while(true){
- Switches_Update(switches, switchD, switchDB, switchesPressed, switchCmb, false, noLink);
- Waitframe();
- }
- }
- void Switches_Update(int switches, int switchD, int switchDB, bool switchesPressed, int switchCmb, bool pressure, bool noLink){
- if(pressure)
- switches[1] = 0;
- for(int i=0; i<switches[0]; ++i){
- int j = i+2;
- int k = switches[j];
- int p = Switch_Pressed(ComboX(k), ComboY(k), noLink);
- if(p){
- if(p!=2)
- Screen->ComboD[k] = switchCmb+1;
- if(!switchesPressed[j]){
- if ( !noLink )
- Game->PlaySound(SFX_SWITCH_PRESS);
- if(switchD[0]>0){
- Screen->D[switchD[j]] |= switchDB[j];
- }
- switchesPressed[j] = true;
- if(!pressure)
- switches[1]++;
- }
- if(pressure)
- switches[1]++;
- }
- else{
- if(switchesPressed[j]){
- if(pressure){
- if ( !noLink )
- Game->PlaySound(SFX_SWITCH_RELEASE);
- Screen->ComboD[k] = switchCmb;
- switchesPressed[j] = false;
- }
- else{
- if(Screen->ComboD[k]!=switchCmb+1)
- Screen->ComboD[k] = switchCmb+1;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement