Ah sorry, I was lazy when I wrote it before.
Code:
ffc script la_compass{
void run(int haveitem, int levelnum, int sfx){
bool checker;
if(sfx == 0) sfx = 27; //If D2 == 0, set the sfx to the secret sound by default
//haveitem == 0, so we're checking for the compass
if(haveitem == 0 && Game->LItems[levelnum] & LI_COMPASS != 0) checker = true;
//Game->LItems[levelnum]. That much means 'bring up the number for what level
//items Link has for the level 'levelnum'.
//It works in binary, and the 3rd bit of the byte is the compass, so we need to check if that's 1 or 0.
//We do that by 'anding' (&) the integer we get by calling 'Game->LItems' with LI_COMPASS (which is 4)
//If what we get isn't 0, then Link has the compass for the level 'levelnum'.
//the boolean is because of the dual function of the script.
//So if haveitem != 0, we want to check whether Link has the item 'haveitem' to see whether to play the sfx
if(haveitem !=0 && Link->Item[haveitem]) checker = true;
//And if one of the two statements above is true, checker will be true, and we can play the sound effect
if(checker) Game->PlaySound(sfx);
}
}
Noted up it should make more sense.
If you don't get the binary I can explain it a bit better?
I feel like I've 1-uped you abit, so sorry =(