Advertisement
ZoriaRPG

Ten Rupee Room v2

Nov 29th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. ffc script tenrupees
  2. {
  3.     void run(int item_id, sdd, imiscd)
  4.     {
  5.         int ten_rupees_x[10] = {120,112,128,96,112,128,144,112,128,120};
  6.         int ten_rupees_y[10] = {49,65,65,81,81,81,81,97,97,113};
  7.         item ten_rupees[10];
  8.        
  9.         if ( !GetScreenDBit(sdd, ( 1 << q )) //Only create the item if Link did not pick up that particular rupee on a previous visit.
  10.         {
  11.             ten_rupees[q] = Screen->CreateItem(Cond((item_id > 0), item_id, I_RUPEE));
  12.             ten_rupees[q]->X = ten_rupees_x[q];
  13.             ten_rupees[q]->Y = ten_rupees_y[q];
  14.             ten_rupees[q]->Misc[imiscd] = 101010+q; //We still mark which (n/10) it is.
  15.             ten_rupees[q]->InitD[0] = imiscd;
  16.             ten_rupees[q]->InitD[1] = sdd;
  17.             ten_rupees[q]->PScript = Game->GetItemScript("TenRupeePickup");
  18.         }
  19.     }
  20. }
  21.  
  22. item script TenRupeePickup
  23. {
  24.     void run(int imiscd, int sdd) //set by the ffc. Do not manually assign!
  25.     {
  26.         int bit = this->Misc[imiscd]-101010; //Mark one bit of Screen D with the ID (n/10) of this rupee.
  27.         //That way, if Link collects it, it won't respawn, because the bit is set, and we only create them
  28.         //if this bit is false.
  29.         SetScreenDBit(sdd, ( (1 << bit), true);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement