Guest User

Untitled

a guest
Dec 14th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. ffc script LockBlock{
  2. void run(int perm, int d, int i, int sfx, int pushtime){
  3. if(pushtime == 0) pushtime = 10;
  4. int loc = ComboAt(this->X,this->Y);
  5.  
  6. int pushclk = 0;
  7. while(!GetScreenDBit(d,perm)){
  8. if(PushingCombo(loc,this)) pushclk++;
  9. else pushclk = 0;
  10. Waitframe();
  11. if(pushclk == pushtime) Unlock(sfx,i,perm,d);
  12. }
  13. SetGraphic(this);
  14. }
  15. void Unlock(int sfx, int i, int perm, int d){
  16. if(!CheckItem(i)) return;
  17. if(sfx == 0) Game->PlaySound(SFX_SHUTTER);
  18. else if(sfx > 0) Game->PlaySound(sfx);
  19. SetScreenDBit(d,perm,true);
  20. }
  21. bool CheckItem(int i){
  22. return (Link->Item[i] == true);
  23. }
  24. bool PushingCombo(int loc, ffc size){
  25. int w = Floor(size->EffectWidth/16); int h = Floor(size->EffectHeight/16);
  26. int x = ComboX(loc); int y = ComboY(loc);
  27. return Link->Z == 0 &&
  28. ((Link->Dir == DIR_UP && Link->InputUp && Link->Y == y+8+16*(h-1) && Abs((Link->X+8)-(x+8*w)) < 8*w)
  29. || (Link->Dir == DIR_DOWN && Link->InputDown && Link->Y == y-16 && Abs((Link->X+8)-(x+8*w)) < 8*w)
  30. || (Link->Dir == DIR_LEFT && Link->InputLeft && Link->X == x+16*w && Abs((Link->Y+8)-(y+8*h)) < 8*h)
  31. || (Link->Dir == DIR_RIGHT && Link->InputRight && Link->X == x-16 && Abs((Link->Y+8)-(y+8*h)) < 8*h));
  32. }
  33. void SetGraphic(ffc size){
  34. int first = ComboAt(size->X,size->Y);
  35. int last = ComboAt(size->X+(size->EffectWidth-16),size->Y+(size->EffectHeight-16));
  36. int w = last%16 - first%16;
  37. for(int i=0;i<=last-first;i++) if(i%16 <= w) Screen->ComboD[first+i]++;
  38. }
  39. }
  40.  
  41. ffc script Copycat{
  42. void run(int perm, int d){
  43. while(!GetScreenDBit(d,perm)) Waitframe();
  44. SetGraphic(this);
  45. }
  46. void SetGraphic(ffc size){
  47. int first = ComboAt(size->X,size->Y);
  48. int last = ComboAt(size->X+(size->EffectWidth-16),size->Y+(size->EffectHeight-16));
  49. int w = last%16 - first%16;
  50. for(int i=0;i<=last-first;i++) if(i%16 <= w) Screen->ComboD[first+i]++;
  51. }
  52. }
Add Comment
Please, Sign In to add comment