Any ideas why??
//This does not consume any magic
//The color of the meter is based on the element equipped to 'B'
//If you release L, the charge ends and nothing happens
//The 1st and 2nd meters only show up if you have the 2nd and 3rd tier spells of the equipped element
//int I_ELEMENTS[5] = {151,147,148,149,150}; //The element items, in the order L,F,W,A,E
int I_ELEMENTSPELLS[15] = { 57, 125, 127, //Light: L.Arrow, L.Aura, Supernova
10, 25, 64, //Fire: Flame/F.Wall, Fireball, Inferno
0, 0, 0, //Water: ???, ???, ???
23, 91, 0, //Air: Whirlwind/S.Wind, Boost jump, ???
54, 0, 124}; //Earth: Tremor, ???, M.Healing
int elementColors[5] = {134, 132, 168, 177, 120}; //Colors of the elements (for the meter)
const int chargeRadius1 = 10; //Radius of tier-2 charge meter
const int chargeTime1 = 55; //Time to charge tier-2 spells
const int chargeRadius2 = 13; //Radius of tier-3 charge meter
const int chargeTime2 = 130; //Total time to charge tier-3 spells
int spellChargeMeter = 0; //Global variable storing spell charge state
//Shared by all five elements
ffc script spellChargeFFC{ //Supposed to be global; using as FFC for testing
void run(){
spellChargeMeter = 0;
while ( true ){
spellCharge();
Waitframe();
}
}
}
void spellCharge(){
int elementEquipped;
if ( Link->InputL && !PD_cooldown ){
elementEquipped = -1;
for ( int i = 0; i < 5; i++ ) //Find what element is equipped
if ( GetEquipmentB() == I_ELEMENTS[i] ){
elementEquipped = i;
break;
}
//If Link is equipping an element and owns the tier-2 spell of that element
if ( elementEquipped > -1 && Link->Item[I_ELEMENTSPELLS[arr2D(elementEquipped,1,3)]] ){
spellChargeMeter++;
//If Link also has tier-3 spell and charge meter is over the tier-1 charge, draw the next meter
if ( Link->Item[I_ELEMENTSPELLS[arr2D(elementEquipped,2,3)]] && spellChargeMeter > chargeTime1 ){
if ( spellChargeMeter > chargeTime2 )
spellChargeMeter = chargeTime2;
}
else if ( spellChargeMeter > chargeTime1 ) //If the tier-3 spell isn't owned, cap the meter at chargeTime1
spellChargeMeter = chargeTime1;
Game->Counter[CR_RUPEES] = spellChargeMeter;
}
}
else{
if ( spellChargeMeter ) //Dissipate charge
spellChargeMeter -= 3;
if ( spellChargeMeter < 0 ) //If charge is negative, set to 0
spellChargeMeter = 0;
}
//Now, draw the meter(s)
if ( spellChargeMeter )
drawMeter ( elementColors[elementEquipped], chargeRadius1, spellChargeMeter, chargeTime1 );
if ( spellChargeMeter > chargeTime1 )
drawMeter ( elementColors[elementEquipped], chargeRadius2, spellChargeMeter-chargeTime1, chargeTime2-chargeTime1 );
}
//Draws a circular meter around Link of the defined color
void drawMeter ( int color, int radius, int curVal, int maxVal ){
if ( curVal >= maxVal ){ //If current value is over the max, draw a full circle
Screen->Circle(7, Link->X+8, Link->Y+8, radius, color, 1, 0, 0, 0, false, 128);
}
else{
Screen->Arc(7, Link->X+8, Link->Y+8, radius, 0, curVal/maxVal*360, color, 1, 0, 0, 0, false, false, 128);
}
}


