import "headers/ghost.zh" import "headers/Moosh.zh" import "headers/ffcscript.zh" import "headers/laser.zh" import "headers/tango.zh" import "headers/tango/font/tango_LttPSmall.zh" import "headers/LinkMovement.zh" import "headers/DialogueBox.zh" import "headers/scrollingDraws.zh" import "headers/theRandomHeader_v2.zh" import "headers/SeededRand.zh" import "include/std_zh/std_constants.zh" import "include/std_zh/std_functions.zh" import "std_zh/std.cfg" // import "include/std.zh" import "include/std_zh/string_constants.zh" import "include/std_zh/string_functions.zh" int G[1000]; const int G_BLOCKS = 0; const int G_MONSTERLENSON = 1; const int G_DIFFICULTY = 2; const int G_LOWESTDIFFICULTY = 3; const int G_ANIMATIONS = 4; const int G_DAMAGE_MULTIPLIER = 5; const int G_WEAPON_MULTIPLIER = 6; const int G_LINK_CURRENT_HP = 7; const int G_LINK_DIRECTDAMAGE = 8; const int G_NUMOFFENSE = 9; const int G_NUMDEFENSE = 10; const int G_INVINCIBLE = 11; const int G_INVISIBLE = 12; const int G_TEMPHEARTCONTAINERS = 13; const int G_TEMPOFFENSEUP = 14; const int G_TEMPDEFENSEUP = 15; const int G_HUGGED = 16; const int G_FISHORBX = 17; const int G_FISHORBY = 18; const int G_FISHORBACTIVE = 19; const int G_FISHORBSTATE = 20; const int G_FISHORBCOOL = 21; const int G_FISHORBANGLE = 22; const int G_FISHORBDROP = 23; const int G_GLOBALFRAMES = 24; const int G_SUBSCREENOPEN = 25; const int G_IN_CUTSCENE = 26; const int G_SUBTIME_FRAMES = 27; const int G_SUBTIME_SECS = 28; const int G_SUBTIME_MINS = 29; const int G_SUBTIME_HOURS = 30; const int G_SUBSCREEN_DELAY = 31; const int G_NOSUBSCREEN = 32; const int G_SUBPOSITION = 33; const int G_LINK_EQUIPA = 34; const int G_LINK_EQUIPB = 35; const int G_LINK_EQUIPL = 36; const int G_LINK_EQUIPR = 37; const int G_LINKSPEED = 38; const int G_ADELAY = 39; const int G_BDELAY = 40; const int G_TORCH = 41; //41-44 are used const int G_BRIDGEMAP1 = 45; const int G_BRIDGESCREEN1 = 46; const int G_BRIDGEMAP2 = 47; const int G_BRIDGESCREEN2 = 48; const int G_BRIDGEIDENTIFIER = 49; const int G_RIGGSJOINED = 50; const int G_NUMALLOY = 51; const int G_TEMPALLOY = 52; const int G_NOITEMS = 53; const int G_LETTER1 = 54; const int G_LETTER2 = 55; const int G_TEMPLETTER1 = 56; const int G_TEMPLETTER2 = 57; const int G_LYNELACTIVE = 58; const int G_LYNELHP = 59; const int G_CURRENTSCREEN = 60; const int G_CURRENTDMAP = 61; const int G_LYNELMAP = 62; const int G_LYNELSCREEN = 63; const int G_GAMESTARTED = 64; const int G_SWIMFRAME = 65; const int G_LASTACTION = 66; const int G_CUTSCENESDISABLED = 67; const int G_INTROSCENE = 68; const int G_NUMTEARS = 69; const int G_POSTLEVELONESCENE = 70; const int G_POSTLEVELTWOSCENE = 71; const int G_TOWNATTACKONEINTRO = 72; const int G_TOWNATTACKONEEXTRO = 73; const int G_RACISMSCENE = 74; const int G_LIGHTSINFUSED = 75; const int G_GRAVESCENE = 76; const int G_LEVELFOURENTRANCESCENE = 77; const int G_LEVELFOURTEARSCENE = 78; const int G_MIDPOINTSCENE = 79; const int G_HPDRAIN = 80; const int G_HPDRAINMODULO = 81; const int G_DNUM_LASTLINKHPDRAIN = 82; const int G_HP_BEEP = 83; const int G_SWIMSCENE = 84; const int G_WAND_TIMER = 85; const int G_WAND_FIRE = 86; const int G_FISHORBCREATED = 87; const int G_FISHORBDROPPEDDMAP = 88; const int G_FISHORBDROPPEDSCREEN = 89; const int G_FISHORBDROPPEDX = 90; const int G_FISHORBDROPPEDY = 91; const int G_AREAITEMSSTART = 92; //This plus the next 18 (19 total) are used to store number of items collected in a given area. const int G_AREAVISITEDSTART = 111; //This and the next 18 are used to store if you've been to an area or not const int G_SUBSCREENAREA = 130; const int G_LASTAREA = 131; const int G_TESTX = 132; const int G_TESTY = 133; const int G_TABLETSTART = 134; //The tablets, next 5 after this are used const int G_HPDRAINDECREASERATE = 140; const int G_HPDRAINPENALTY = 141; const int G_DEFCURSE = 142; const int G_ITEMPOPUP = 143; const int G_ITEMPOPUP_LENGTH = 144; const int G_ITEMPOPUP_X = 145; const int G_ITEMPOPUP_Y = 146; const int G_ITEMPOPUPTYPE = 147; const int G_ITEMPOPUPTWO = 148; const int G_ITEMPOPUPADVANCE = 149; const int G_MESSAGEMAP = 150; const int G_MESSAGEKEY = 151; const int G_MESSAGEOFFENSE = 152; const int G_MESSAGEDEFENSE = 153; const int G_MESSAGEHEART = 154; const int G_MESSAGEALLOY = 155; const int G_POSTLEVELFIVESCENE = 156; const int G_POSTLEVELSEVENSCENE = 157; const int G_POSTBOSSFIVESCENE = 158; const int G_POSTBOSSSIXSCENE = 159; const int G_TOWERSCENESTART = 160; //8 total const int G_LIGHTTIMER = 168; const int G_DEFCURSEAPP = 169; const int G_STATUSCOOLDOWN = 170; const int G_ALIYAFIGHTPRESCENE = 171; const int G_PREZELDASCENE = 172; const int G_PREZELDASCENETWO = 173; const int G_ALIYAINPARTY = 174; const int G_ZELDAMIDPOINT = 175; const int G_STOPTIMER = 176; const int G_MORTALDAMAGE_BEEP = 177; const int G_SUPPRESSDAMAGENUMBERS = 178; const int G_LASTDMAP = 179; const int G_RANDO = 180; const int G_SEED1 = 181; const int G_SEED2 = 182; const int G_LASTSCREEN = 183; //Zippidy doo da, zippidy day, ZC is awful and someone should pay const int G_LYNELRANDO = 184; const int G_TABLETRANDO = 185; const int G_REQUIREDRANDO = 186; const int G_TEARRANDO = 187; const int G_MAXLIGHTTIMER = 188; const int G_WHICHLYNEL = 189; const int G_LYNELITEMSTART = 190; //This through 194 are in us const int G_KELLATTACK = 195; const int G_KELLDEFENSE = 196; const int G_KELLSPEED = 197; const int G_RIGGSATTACK = 198; const int G_RIGGSDEFENSE = 199; const int G_RIGGSSPEED = 200; const int G_STATSRANDO = 201; const int G_KELLCALCSPEED = 202; const int G_RIGGSCALCSPEED = 203; const int G_JUNKRANDO = 204; const int G_KELLCALCDEFENSE = 205; const int G_RIGGSCALCDEFENSE = 206; const int DIF_VEASY = -2; const int DIF_EASY = -1; const int DIF_NORMAL = 0; const int DIF_HARD = 1; const int DIF_VHARD = 2; const int CLW_TIMER =5; //lweapon Misc variable index for countdown const int I_TRUE = 1; const int I_FALSE = 0; const int RING_RIGGS = 200; const int RING_ALIYA = 215; int PickupString[50]; //Keeping track of Misc values: //LWeapons: //0 - Used by fire weapons for burning stuff. If 0, will only light the initial bush. if 1, will spread to nearby bushes. Used by ice weapons to determine if it's a projectile or a block //1 - Used by ice blocks to determine remaining pushes. Used by candle fire //5 (CLW_TIMER) - If set to greater than 0, acts as a timer, after which lweapon will be removed //NPCs: //0 - Used by fire projectile from wand. Flame will only be dropped at location if Misc[0] == 0; cooldown timer. Also used for marking falling enemies //1 - Used for burning //4 - Used by the mirror //5 - Used by the PitFish (Why the fuck does ghost not have a function to get the associated FFC)? Also by patra babies. Also by jellyfish void ClearString(int string){ for(int i = 0; i = 0) DriftingObjectsAngle[i] = Rand(0, 360); if(Abs(DriftingObjectsAngle[i]) >= 0 && Abs(DriftingObjectsAngle[i]) < 90){ int rando = Rand(0,1); if(rando == 0 || Abs(DriftingObjectsAngle[i]) == 0){ DriftingObjectsX[i] = 0-DriftingObjectsSize[i]*16; DriftingObjectsY[i] = Rand(32, 144); } else{ DriftingObjectsX[i] = Rand(32, 234); DriftingObjectsY[i] = 0-DriftingObjectsSize[i]*16; } } if(Abs(DriftingObjectsAngle[i]) >= 90 && Abs(DriftingObjectsAngle[i]) < 180){ int rando = Rand(0,1); if(rando == 0 || Abs(DriftingObjectsAngle[i]) == 90){ DriftingObjectsX[i] = Rand(32, 234); DriftingObjectsY[i] = 0-DriftingObjectsSize[i]*16; } else{ DriftingObjectsX[i] = 256; DriftingObjectsY[i] = Rand(32, 144); } } if(Abs(DriftingObjectsAngle[i]) >= 180 && Abs(DriftingObjectsAngle[i]) < 270){ int rando = Rand(0,1); if(rando == 0 || Abs(DriftingObjectsAngle[i]) == 180){ DriftingObjectsX[i] = 256; DriftingObjectsY[i] = Rand(32, 144); } else{ DriftingObjectsX[i] = Rand(32, 234); DriftingObjectsY[i] = 176; } } if(Abs(DriftingObjectsAngle[i]) >= 270 && Abs(DriftingObjectsAngle[i]) <= 360){ int rando = Rand(0,1); if(Abs(DriftingObjectsAngle[i]) == 360){ DriftingObjectsX[i] = 256; DriftingObjectsY[i] = Rand(32, 144); } else if(rando == 0 || Abs(DriftingObjectsAngle[i]) == 270){ DriftingObjectsX[i] = Rand(32, 234); DriftingObjectsY[i] = 176; } else{ DriftingObjectsX[i] = 0-DriftingObjectsSize[i]*16; DriftingObjectsY[i] = Rand(32, 144); } } DriftingObjectsWait[i] = -1; } else{ if(DriftingObjectsWait[i] == -1){ if(DriftingObjectsPattern[i] == 0){ DriftingObjectsX[i] += VectorX(DriftingObjectsVelocity[i], Abs(DriftingObjectsAngle[i])); DriftingObjectsY[i] += VectorY(DriftingObjectsVelocity[i], Abs(DriftingObjectsAngle[i])); DriftingObjectsAngle[i] += DriftingObjectsArg1[i]; if(DriftingObjectsX[i] > 272 || DriftingObjectsX[i] < -16-DriftingObjectsSize[i]*16 || DriftingObjectsY[i] > 192 || DriftingObjectsY[i] < -16-DriftingObjectsSize[i]*16){ DriftingObjectsWait[i] = DriftingObjectsFrequency[i]+Rand(0, DriftingObjectsFrequency[i]/2); DriftingObjectsX[i] = 0; DriftingObjectsY[i] = 0; } } if(DriftingObjectsPattern[i] == 1){ DriftingObjectsMisc[i] += DriftingObjectsArg2[i]; int offset= DriftingObjectsArg1[i]*Sin(DriftingObjectsMisc[i]); int curx = DriftingObjectsX[i]; int cury = DriftingObjectsY[i]; curx += DriftingObjectsVelocity[i]*Cos(Abs(DriftingObjectsAngle[i])); cury += DriftingObjectsVelocity[i]*Sin(Abs(DriftingObjectsAngle[i])); DriftingObjectsX[i] = curx+offset*Cos(Abs(DriftingObjectsAngle[i])+90); DriftingObjectsY[i] = cury+offset*Sin(Abs(DriftingObjectsAngle[i])+90); if(DriftingObjectsX[i] > 272 || DriftingObjectsX[i] < -16-DriftingObjectsSize[i]*16 || DriftingObjectsY[i] > 192 || DriftingObjectsY[i] < -16-DriftingObjectsSize[i]*16){ DriftingObjectsWait[i] = DriftingObjectsFrequency[i]+Rand(0, DriftingObjectsFrequency[i]/2); DriftingObjectsX[i] = 0; DriftingObjectsY[i] = 0; } } } if(DriftingObjectsWait[i] >0) DriftingObjectsWait[i]--; else{ int flip; if(Abs(DriftingObjectsAngle[i]) > 270 && Abs(DriftingObjectsAngle[i]) <= 360) flip = 1; else if(Abs(DriftingObjectsAngle[i]) >= 0 && Abs(DriftingObjectsAngle[i]) < 90) flip = 1; Screen->DrawCombo(5, DriftingObjectsX[i], DriftingObjectsY[i], DriftingObjectsCombo[i], DriftingObjectsSize[i], DriftingObjectsSize[i], 1, -1, -1, 0, 0, 0, 0, flip, true, OP_OPAQUE); } } } } //SmallBubble //SmallBubble LargeBubble TinyBubble TinyBubble TinyBubble TinyBubble RedFish BlueFish PurpFish YellFish BoneFish PurpJelly int DriftingObjectsCombo[] = {1249, 1249, 1250, 1248, 1248, 1248, 1248, 1252, 1253, 1254, 1255, 1256, 1257}; int DriftingObjectsSize[] = {1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; int DriftingObjectsFrequency[] = {60, 60, 120, 16, 16, 16, 16, 600, 700, 800, 900, 99999, 1000}; int DriftingObjectsX[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int DriftingObjectsY[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int DriftingObjectsAngle[] = {-270, -270, -270, -270, -270, -270, -270, 0, 0, 0, 0, 0, 0}; int DriftingObjectsVelocity[] = {1, 1, .5, 2, 2, 2, 2, 1, 3, 2, 3, 2, 1}; int DriftingObjectsPattern[] = {1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1}; int DriftingObjectsArg1[] = {2, 1, .5, 2, 2, 2, 2, 0, 1, 0, 1, 0, 1}; int DriftingObjectsArg2[] = {2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1, 0, 2}; int DriftingObjectsWait[] = {60, 90, 120, 0, 20, 40, 60, 60, 120, 240, 320, 480, 600}; int DriftingObjectsMisc[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; const int I_MONSTERMIRROR = 186; void MonsterMirror_Toggle(){ if(Link->Item[I_MONSTERMIRROR]&&Link->PressEx2){ if(G[G_MONSTERLENSON]>0){ G[G_MONSTERLENSON] = 0; Game->PlaySound(103); } else{ G[G_MONSTERLENSON] = 1; Game->PlaySound(102); } } } item script MonsterMirror{ void run(){ if(G[G_MONSTERLENSON]>0){ G[G_MONSTERLENSON] = 0; Game->PlaySound(103); } else{ G[G_MONSTERLENSON] = 1; Game->PlaySound(102); } } } bool InArray(int array, int val){ for(int i=0; iID==245) return; //Screen->DrawInteger(6, n->X, n->Y-8, FONT_Z1, 0x01, -1, -1, -1, n->ID, 0, 128); if(Link->Item[I_MONSTERMIRROR]&&G[G_MONSTERLENSON]>0){ int Leevers[] = {26, 27, 137, 246}; int Wizzrobes[] = {56, 152, 214, 228, 198, 100, 208}; int Gleeoks[] = {62, 63, 64, 65, 247}; bool SpecialException; if(InArray(Leevers, n->ID)&&(n->Tile==96||n->Tile==97)) SpecialException = true; if(InArray(Wizzrobes, n->ID)&&n->HitXOffset==1000) SpecialException = true; if(n->Type==NPCT_WALLMASTER&&n->HitXOffset==1000) SpecialException = true; if(InArray(Gleeoks, n->ID)&&n->Tile!=50540&&n->Tile!=145) SpecialException = true; if(n->ID == 270 && n->Misc[5] == 1) SpecialException = true; if(n->ID == 185 || n->ID == 204 || n->ID == 294 || n->ID == 243 || n->ID == 299 || n->ID == 300) SpecialException = true; int Exceptions[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 259, 111, 256, 204, 265, 116, 187, 118, 119, 117, 81, 82, 51, 217, 180, 84, 249, 247}; if(CenterX(n)>0&&CenterX(n)<256&&CenterY(n)>0&&CenterY(n)<176){ if(!InArray(Exceptions, n->ID)&&n->DrawYOffset>-1000&&n->HitXOffset<1000&&n->CollDetection&&!SpecialException&&n->Type!=NPCT_TRAP&&n->Type!=NPCT_PROJECTILE){ int HP = n->HP; int MaxHP = n->Misc[NM_MAXHP]; if(n->ID==215){ //heart of sin HP = Max(0, HP-1000); MaxHP = Max(0, MaxHP-1000); } // Screen->DrawInteger(6, n->X, n->Y-16, FONT_Z1, 0x01, -1, -1, -1, HP, 0, 128); // Screen->DrawInteger(6, n->X, n->Y-8, FONT_Z1, 0x01, -1, -1, -1, MaxHP, 0, 128); Screen->Rectangle(4, CenterX(n)-8, CenterY(n)-16, CenterX(n)+8, CenterY(n)-12, 0x0f, 1, 0, 0, 0, true, 128);//DrawInteger(7, CenterX(n)-XOff, CenterY(n)-16, FONT_Z1, Color, -1, -1, -1, HP, 0, 128); if(HP>0) Screen->Rectangle(4, CenterX(n)-7, CenterY(n)-15, CenterX(n)-7+14*Clamp(HP/MaxHP, 0, 1), CenterY(n)-13, 0x81, 1, 0, 0, 0, true, 128); } } } } void MonsterMirrorSpecial(npc n, int HP, int MaxHP){ if(Link->Item[I_MONSTERMIRROR]&&G[G_MONSTERLENSON]>0){ Screen->Rectangle(4, CenterX(n)-8, CenterY(n)-16, CenterX(n)+8, CenterY(n)-12, 0x0f, 1, 0, 0, 0, true, 128);//DrawInteger(7, CenterX(n)-XOff, CenterY(n)-16, FONT_Z1, Color, -1, -1, -1, HP, 0, 128); if(HP>0) Screen->Rectangle(4, CenterX(n)-7, CenterY(n)-15, CenterX(n)-7+14*Clamp(Max(0, HP)/MaxHP, 0, 1), CenterY(n)-13, 0x81, 1, 0, 0, 0, true, 128); } } const int NM_MAXHP = 4; void MonsterMaxHP(npc n){ if(n->Misc[NM_MAXHP]<=0){ n->Misc[NM_MAXHP] = n->HP; } if(n->ID == 283) //Super Lynel n->Misc[NM_MAXHP] = 5000; } const int NM_DIFFICULTY = 2; const int EM_DIFFICULTY = 2; void HighestDifficulty(){ if(G[G_DIFFICULTY]Misc[NM_DIFFICULTY]==0){ if(G[G_DIFFICULTY]==-2){ n->Damage /= 2; n->Misc[NM_DIFFICULTY] = 1; } else if(G[G_DIFFICULTY]==-1){ n->Damage *= 0.75; n->Misc[NM_DIFFICULTY] = 1; } else if(G[G_DIFFICULTY]==1){ n->Damage *= 2; n->Misc[NM_DIFFICULTY] = 1; } } } void DifficultyEWeapon(eweapon e){ if(e->Misc[EM_DIFFICULTY]==0){ if(G[G_DIFFICULTY]==-2){ e->Damage /= 2; e->Misc[EM_DIFFICULTY] = 1; } else if(G[G_DIFFICULTY]==-1){ e->Damage *= 0.75; e->Misc[EM_DIFFICULTY] = 1; } else if(G[G_DIFFICULTY]==1){ e->Damage *= 2; e->Misc[EM_DIFFICULTY] = 1; } } } //Creates and returns a windier copy of the passed EWeapon. Assumes that the passed pointer is valid. eweapon DuplicateWind(eweapon a) { eweapon b = Screen->CreateEWeapon(EW_WIND); b->X = a->X; b->Y = a->Y; b->Z = a->Z; b->Jump = a->Jump; b->Extend = a->Extend; b->TileWidth = a->TileWidth; b->TileHeight = a->TileHeight; b->HitWidth = a->HitWidth; b->HitHeight = a->HitHeight; b->HitZHeight = a->HitZHeight; b->HitXOffset = a->HitXOffset; b->HitYOffset = a->HitYOffset; b->DrawXOffset = a->DrawXOffset; b->DrawYOffset = a->DrawYOffset; b->DrawZOffset = a->DrawZOffset; b->UseSprite(36); b->DrawStyle = a->DrawStyle; b->Dir = a->Dir; b->Damage = a->Damage; b->Step = a->Step; b->Angle = a->Angle; b->Angular = a->Angular; b->CollDetection = a->CollDetection; b->DeadState = a->DeadState; for (int i = 0; i < 16; i++) b->Misc[i] = a->Misc[i]; return b; } global script Slot2{ void run(){ if(G[G_GAMESTARTED] == 0){ G[G_GAMESTARTED] = 1; G[G_AREAVISITEDSTART + 5] = 1; G[G_AREAVISITEDSTART + 6] = 1; // G[G_NUMALLOY] = 2; // G[G_NUMOFFENSE] = 4; // G[G_NUMDEFENSE] = 4; // G[G_NUMTEARS] = 8; // G[G_LIGHTSINFUSED] = 8; // G[G_INTROSCENE] = 1; // G[G_TOWNATTACKONEINTRO] = 1; // G[G_TOWNATTACKONEEXTRO] = 1; // G[G_MIDPOINTSCENE] = 1; // G[G_RIGGSJOINED] = 1; // G[G_PREZELDASCENETWO] = 1; // G[G_PREZELDASCENE] = 1; // G[G_RANDO] = 1; } if(G[G_ALIYAINPARTY] == 1){ G[G_ALIYAINPARTY] = 0; Link->Item[RING_ALIYA] = false; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 216){ if(Link->Item[205]) G[i] = 205; else G[i] = 203; } } if(Link->Item[205]){ ItemIDs[0] = 205; ItemTiles[0] = 19780; ItemCSets[0] = 7; } else{ ItemIDs[0] = 203; ItemTiles[0] = 19761; ItemCSets[0] = 7; } } if(G[G_RANDO] == 1) SetScreenDataForRando(); G[G_LIGHTTIMER] = G[G_MAXLIGHTTIMER]; G[G_DEFCURSE] = 0; G[G_HPDRAINPENALTY] = 0; G[G_HP_BEEP] = 0; G[G_HPDRAIN] = 0; G[G_LYNELACTIVE] = 0; UndoLynelMusic(); DriftingObjectsCombo[7] = 1252; G[G_SUBSCREENOPEN] = I_FALSE; SetEquipmentA(ITM_NULL); SetEquipmentB(ITM_NULLB); int LinkHP = Link->HP; int LinkHPB = Link->HP; Link->Invisible = false; Link->CollDetection = true; InitializeGhostZHData(); SetUpStyles(); __Tango_Data[__TDIDX_GLOBAL_FLAGS] - __TANGO_GFLAG_UNPRESS_ALL; Tango_Start(); __Tango_Data[__TDIDX_GLOBAL_FLAGS] - __TANGO_GFLAG_UNPRESS_ALL; for(int i = __TANGO_NUM_SLOTS-1; i>=0; i--){ Tango_ClearSlot(i); } DamageNumbers_Init(); ScrollingDraws_Init(); if(Game->GetCurDMap() == 6) //Reset the spinner in level 2 RunFFCScript(10, 0); // int number; while(true){ if(G[G_DIFFICULTY] == DIF_VHARD) G[G_HPDRAINDECREASERATE] = 1; else if(G[G_DIFFICULTY] == DIF_HARD) G[G_HPDRAINDECREASERATE] = 2; else G[G_HPDRAINDECREASERATE] = 3; G[G_HPDRAINMODULO] = Max(G[G_LIGHTSINFUSED] * G[G_HPDRAINDECREASERATE],1); G[G_HPDRAINMODULO] = Max(G[G_HPDRAINMODULO] - G[G_HPDRAINPENALTY] * G[G_HPDRAINDECREASERATE],1); Game->Counter[CR_SCRIPT2] = G[G_NUMALLOY]; G[G_MAXLIGHTTIMER] = G[G_LIGHTSINFUSED] * 1575; if(Game->DMapFlags[Game->GetCurDMap()] & DMF_SCRIPT5) UpdateDrifters(); UpdateGhostZH1(); Tango_Update1(); LinkMovement_Update1(); DamageAndSpeed(); CurseTimer(); if(G[G_HP_BEEP] == 0 && (Link->HP - G[G_HPDRAIN] <= Link->MaxHP * 0.2 || Link->HP - G[G_HPDRAIN] <= 16)){ G[G_HP_BEEP] = 1; Game->PlaySound(85); } if(G[G_HP_BEEP] == 1 && Link->HP - G[G_HPDRAIN] > Link->MaxHP * 0.2 && Link->HP - G[G_HPDRAIN] > 16) G[G_HP_BEEP] = 0; if(G[G_MORTALDAMAGE_BEEP] == 0 && (Link->HP - G[G_HPDRAIN] <= 0)){ G[G_MORTALDAMAGE_BEEP] = 1; Game->PlaySound(86); } if(G[G_MORTALDAMAGE_BEEP] == 1 && Link->HP - G[G_HPDRAIN] > 0) G[G_MORTALDAMAGE_BEEP] = 0; if(Link->Action == LA_FROZEN){ if(Screen->ComboI[ComboAt(Link->X + 8, Link->Y + 8)] == 7){ G[G_HPDRAIN] = 0; G[G_HPDRAINPENALTY] = 0; } } if(G[G_SUPPRESSDAMAGENUMBERS] > 0) G[G_SUPPRESSDAMAGENUMBERS]--; if(Game->GetCurDMap() != G[G_LASTDMAP]){ G[G_SUBSCREENAREA] = GetAreaID(Game->GetCurDMap()); if(G[G_SUBSCREENAREA] == -1) G[G_SUBSCREENAREA] = G[G_LASTAREA]; else G[G_LASTAREA] = G[G_SUBSCREENAREA]; G[G_LASTDMAP] = Game->GetCurDMap(); } if(Game->GetCurScreen() != G[G_LASTSCREEN]){ if(Game->GetCurScreen() != 0x80) G[G_LASTSCREEN] = Game->GetCurScreen(); } Wand(); npc n; for(int i = Screen->NumNPCs(); i >0; i--){ //NPC loop n = Screen->LoadNPC(i); MonsterMaxHP(n); MonsterMirror(n); DamageNumbers_UpdateEnemyDamage(n); if(n->Misc[0] > 0 && G[G_SUBSCREENOPEN] == 0) n->Misc[0]--; if(n->Misc[1] > 0 && G[G_SUBSCREENOPEN] == 0){ Screen->FastCombo(3, n->X, n->Y, 4979, 8, OP_TRANS); n->Misc[1]--; if(n->Misc[1] % 15 == 0 || n->Misc[1] == 0){ Game->PlaySound(11); if(!((n->ID == 283 || n->ID == 299) && n->HP <= 0.5 * G[G_WEAPON_MULTIPLIER])) n->HP -= 0.5 * G[G_WEAPON_MULTIPLIER]; } } } for(int i = 1; i<=Screen->NumLWeapons(); i++){ //LWeapon loop lweapon l = Screen->LoadLWeapon(i); if(l->Misc[CLW_TIMER]>0 && G[G_SUBSCREENOPEN] == I_FALSE){ l->Misc[CLW_TIMER]--; if(l->Misc[CLW_TIMER] == 1){ l->DeadState = 0; } } if(l->ID == LW_MAGIC){ //Swords picking up items for(int i = Screen->NumItems(); i >0; i--){ item item1 = Screen->LoadItem(i); if(Collision(l, item1) && item1->isValid() && (item1->ID == 2 || item1->ID == 34 || item1->ID == 69 || item1->ID == 0 || item1->ID == 1 || item1->ID == 86 || item1->ID == 146 || item1->ID == 3)){ item1->Tile = 40; item1->Misc[1] = 1; item1->X = Link->X; item1->Y = Link->Y; item1->Pickup |= 64; } } if(((Link->Item[RING_RIGGS] && Link->Item[207]) || Link->Item[RING_ALIYA]) && Rand(0,9) == 0){ for(int j = Screen->NumNPCs(); j >0; j--){ //NPC loop n = Screen->LoadNPC(j); if(Collision(n, l) && n->Misc[1] == 0 && n->Defense[NPCD_MAGIC] != NPCDT_IGNORE && n->Defense[NPCD_MAGIC] != NPCDT_BLOCK && n->CollDetection == true){ n->Misc[1] = 61; } } } } if(l->ID == LW_ARROW){ //148 if(G[G_GLOBALFRAMES] % 8 == 0){ for(int i = -17; i<=-15; i++){ if(ComboAt(l->X, l->Y) + i >= 0 && ComboAt(l->X, l->Y) + i <= 175){ int Flag = Screen->ComboF[ComboAt(l->X, l->Y) + i]; if(Flag == 4 || Flag == 5 || Flag == 6 || Flag == 1 || Flag == 2){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, ComboX(ComboAt(l->X, l->Y) + i), ComboY(ComboAt(l->X, l->Y) + i)); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } Flag = GetLayerComboF(1, ComboAt(l->X, l->Y) + i); if(Flag == 4 || Flag == 5 || Flag == 6 || Flag == 1 || Flag == 2){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, ComboX(ComboAt(l->X, l->Y) + i), ComboY(ComboAt(l->X, l->Y) + i)); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } } for(int i = -1; i<=1; i++){ if(ComboAt(l->X, l->Y) + i >= 0 && ComboAt(l->X, l->Y) + i <= 175){ int Flag = Screen->ComboF[ComboAt(l->X, l->Y) + i]; if(Flag == 4 || Flag == 5 || Flag == 6 || Flag == 1 || Flag == 2){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, ComboX(ComboAt(l->X, l->Y) + i), ComboY(ComboAt(l->X, l->Y) + i)); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } Flag = GetLayerComboF(1, ComboAt(l->X, l->Y) + i); if(Flag == 4 || Flag == 5 || Flag == 6 || Flag == 1 || Flag == 2){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, ComboX(ComboAt(l->X, l->Y) + i), ComboY(ComboAt(l->X, l->Y) + i)); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } } for(int i = 15; i<=17; i++){ if(ComboAt(l->X, l->Y) + i >= 0 && ComboAt(l->X, l->Y) + i <= 175){ int Flag = Screen->ComboF[ComboAt(l->X, l->Y) + i]; if(Flag == 4 || Flag == 5 || Flag == 6 || Flag == 1 || Flag == 2){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, ComboX(ComboAt(l->X, l->Y) + i), ComboY(ComboAt(l->X, l->Y) + i)); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } Flag = GetLayerComboF(1, ComboAt(l->X, l->Y) + i); if(Flag == 4 || Flag == 5 || Flag == 6 || Flag == 1 || Flag == 2){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, ComboX(ComboAt(l->X, l->Y) + i), ComboY(ComboAt(l->X, l->Y) + i)); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } } if(Screen->Door[DIR_UP] == D_BOMB && Distance(l->X, l->Y, 120, 16) < 20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, 120, 16); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } if(Screen->Door[DIR_DOWN] == D_BOMB && Distance(l->X, l->Y, 120, 144) < 20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, 120, 144); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } if(Screen->Door[DIR_LEFT] == D_BOMB && Distance(l->X, l->Y, 16, 80) < 20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, 16, 80); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } if(Screen->Door[DIR_RIGHT] == D_BOMB && Distance(l->X, l->Y, 224, 80) < 20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, 224, 80); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } if(G[G_FISHORBACTIVE] == 1){ if(Distance(l->X, l->Y, G[G_FISHORBX], G[G_FISHORBY]) < 8 && G[G_FISHORBCOOL] == 0){ Game->PlaySound(77); G[G_FISHORBCOOL] = 60; if(G[G_FISHORBSTATE] == 0) G[G_FISHORBSTATE] = 1; else G[G_FISHORBSTATE] = 0; } } } if(l->ID == LW_BOMB || l->ID == LW_FIRE){ if(l->Damage <=50) l->Damage = (l->Damage*G[G_WEAPON_MULTIPLIER] + l->Damage*100 + l->Damage*100)/3; //Damage increases with weapon multipliers, but is weighted heavily towards base damage } if(l->ID == LW_BEAM){ //Oh boy... I hate have to check weapons against enemies... for(int j = Screen->NumNPCs(); j >0; j--){ //NPC loop n = Screen->LoadNPC(j); if(Collision(n, l) && n->Misc[0] == 0){ lweapon Fire = CreateLWeaponAt(LW_FIRE, n->X, n->Y); Fire->UseSprite(109); Fire->Damage = l->Damage; n->Misc[0] = 45; Fire->Step = 0; Fire->Dir = l->Dir; } } if(Screen->ComboF[ComboAt(l->X+8, l->Y+8)] == 4 || GetLayerComboF(1, ComboAt(l->X+8, l->Y+8)) == 4){ lweapon Fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(l->X+8, l->Y+8)), ComboY(ComboAt(l->X+8, l->Y+8))); Fire->UseSprite(109); Fire->Damage = l->Damage; Fire->Step = 0; } } if(l->ID == LW_REFROCK && l->Misc[0] != 1){ //Oh boy all over again for(int j = Screen->NumNPCs(); j >0; j--){ //NPC loop n = Screen->LoadNPC(j); if(Collision(n, l)){ if(n->HP <= l->Damage && n->TileWidth == 1 && n->TileHeight == 1 && n->CollDetection && n->Defense[NPCD_REFROCK] != NPCDT_IGNORE && n->Defense[NPCD_REFROCK] != NPCDT_BLOCK && IsFreezable(n)){ // lweapon iceblock = CreateLWeaponAt(LW_REFROCK, n->X, n->Y); // l->Misc[CLW_TIMER] = 2; // iceblock->Damage = 200; // iceblock->Step = 0; // iceblock->CollDetection = false; // iceblock->UseSprite(130); // iceblock->Misc[1] = 3; // iceblock->Misc[0] = 1; ffc f = FindFreeFFC(); f->X = GridX(n->X); f->Y = GridY(n->Y); f->Data = 4767; f->CSet = 7; f->Script = 40; if(Splitter(n)) n->Misc[8] = 1; else{ SetEnemyProperty(n, ENPROP_Y, -1000); n->Y = -1000; } Game->PlaySound(44); // if(CountFFCsRunning(29) == 0) // RunFFCScript(29, NULL); } else{ lweapon Fire = CreateLWeaponAt(LW_REFROCK, n->X, n->Y); Fire->UseSprite(129); Fire->Damage = l->Damage; Fire->Misc[0] = 1; Fire->Dir = l->Dir; Remove(l); } } } } // if(l->ID == LW_REFROCK && l->Misc[0] == 1){ // if(!CanWalk(l->X, l->Y, l->Dir, l->Step/100, true)){ // l->Step = 0; // l->CollDetection = false; // l->Misc[1]--; // if(l->Misc[1] == 0){ // lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, l->X+Rand(-8, 8), l->Y+Rand(-8, 8)); // l2->UseSprite(115); // l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; // l2->CollDetection = false; // Game->PlaySound(66); // Remove(l); // } // } // } if(l->ID == LW_REFMAGIC){ //One last "Oh boy..." if(l->Misc[0] == 1 && G[G_GLOBALFRAMES] % 5 == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, l->X+Rand(-8, 8), l->Y+Rand(-8, 8)); l2->UseSprite(131); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; } for(int j = Screen->NumNPCs(); j >0; j--){ //NPC loop n = Screen->LoadNPC(j); if(Collision(n, l) && n->Misc[0] == 0){ lweapon Fire = CreateLWeaponAt(LW_FIRE, n->X, n->Y); Fire->UseSprite(132); Fire->Damage = l->Damage; n->Misc[0] = 45; Fire->Step = 0; Fire->Dir = l->Dir; if(l->Misc[0] == 0){ Game->PlaySound(82); for(int k = Screen->NumNPCs(); k >0; k--){ //ENEMY LOOPCEPTION BECAUSE WHY NOT npc n2 = Screen->LoadNPC(k); if(n2->CollDetection && n2->Defense[NPCD_REFMAGIC] != NPCDT_IGNORE && n2->Defense[NPCD_REFMAGIC]!= NPCDT_BLOCK){ lweapon Ball = CreateLWeaponAt(LW_REFMAGIC, n->X, n->Y); Ball->UseSprite(132); Ball->Angular = true; Ball->Angle = DegtoRad(Angle(n->X, n->Y, n2->X, n2->Y)); Ball->CollDetection = false; Ball->Misc[0] = 1; Ball->Damage = l->Damage; Ball->Step = 500; Ball->Dir = l->Dir; } } } Remove(l); } } if(Screen->ComboF[ComboAt(l->X, l->Y)] == 4 || GetLayerComboF(1, ComboAt(l->X, l->Y)) == 4){ lweapon Fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(l->X, l->Y)), ComboY(ComboAt(l->X, l->Y))); Fire->UseSprite(109); Fire->Damage = l->Damage; Fire->Step = 0; Fire->Dir = l->Dir; } } } if(Game->GetCurDMap() == 7 || Game->GetCurDMap() == 8 || Game->GetCurDMap() == 31) FishOrb(); else G[G_FISHORBACTIVE] = 0; if(G[G_INVISIBLE]>0){ Link->Invisible = true; G[G_INVISIBLE]--; } else Link->Invisible = false; if(G[G_NOITEMS] > 0) G[G_NOITEMS]--; if(G[G_MONSTERLENSON]>0){ DamageNumbers_UpdateLink(); DamageNumbers_UpdateNumberGFX(); } if(Link->SwordJinx != 0 && G[G_GLOBALFRAMES]%5==0){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, Link->X+Rand(-8, 8), Link->Y-Link->Z+Rand(-8, 8)); l->UseSprite(133); l->DeadState = l->NumFrames*l->ASpeed; } if(G[G_DEFCURSE] > 0 && G[G_GLOBALFRAMES]%5==0){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, Link->X+Rand(-8, 8), Link->Y-Link->Z+Rand(-8, 8)); l->UseSprite(147); l->DeadState = l->NumFrames*l->ASpeed; } if(G[G_STATUSCOOLDOWN] > 0) G[G_STATUSCOOLDOWN]--; if(G[G_BRIDGEMAP1] != 0 && G[G_BRIDGEIDENTIFIER] != Game->GetCurMap() + Game->GetCurScreen()){ for(int i = 0; i<176; i++){ if(IHateZC[i] != 0) Game->SetComboData(G[G_BRIDGEMAP1], G[G_BRIDGESCREEN1], i, IHateZC[i]); if(IHateZC[i+176] != 0) Game->SetComboData(G[G_BRIDGEMAP2], G[G_BRIDGESCREEN2], i, IHateZC[i + 176]); } G[G_BRIDGEMAP1] = 0; } if(G[G_LYNELACTIVE] == 1){ if((Game->GetCurScreen() != G[G_CURRENTSCREEN] || Game->GetCurDMap() != G[G_CURRENTDMAP]) && CountFFCsRunning(31) == 0) RunFFCScript(31, 0); } if(G[G_ITEMPOPUP] > 0 && G[G_ITEMPOPUPTYPE] == 1){ if(G[G_BRIDGEIDENTIFIER] == Game->GetCurMap() + Game->GetCurScreen()) Screen->DrawBitmap (1, RT_BRIDGE, 0, 0, 248, 168, 0, 0, 248, 168, 0, true); G[G_NOITEMS] = 2; G[G_WAND_FIRE] = 0; G[G_WAND_TIMER] = 0; Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; Link->InputB = false; Link->PressB = false; if(G[G_ITEMPOPUP] == 253){ Screen->SetRenderTarget(RT_ITEMPOPUP); Screen->DrawBitmap(6, __TANGO_BITMAP, 0, 0, 248, 168, 8, 40, 248, 168, 0, true); Screen->SetRenderTarget(RT_SCREEN); Tango_ClearSlot(0); } G[G_ITEMPOPUP_X] = Clamp(G[G_ITEMPOPUP],40, 256); G[G_ITEMPOPUP_Y] = 48- G[G_ITEMPOPUPTWO]; G[G_ITEMPOPUP_Y] = Clamp(G[G_ITEMPOPUP_Y], -60, 48); Screen->DrawBitmap(6, RT_ITEMPOPUP, 0, 0, 160, 80, G[G_ITEMPOPUP_X], G[G_ITEMPOPUP_Y], 160, 80, 0, true); Tango_SetSlotPosition(0, G[G_ITEMPOPUP_X], G[G_ITEMPOPUP_Y]+32); if(G[G_ITEMPOPUP] > 2){ G[G_ITEMPOPUP] -=4; Link->InputA = false; Link->PressA = false; } if(G[G_ITEMPOPUP] == 1) if(G[G_ITEMPOPUPADVANCE] == 0){ if(Link->PressA) G[G_ITEMPOPUPADVANCE] = 1; } else G[G_ITEMPOPUPTWO]+=3; if(G[G_ITEMPOPUPTWO] == 108){ G[G_ITEMPOPUP] = 0; UnfreezeScreen(); Link->Action = LA_NONE; } } else if(G[G_ITEMPOPUP] > 0 && G[G_ITEMPOPUPTYPE] == 0){ G[G_ITEMPOPUP_X] = Clamp(G[G_ITEMPOPUP],256-(G[G_ITEMPOPUP_LENGTH]+8), 256); G[G_ITEMPOPUP_Y] = 12- ((256-G[G_ITEMPOPUP_LENGTH]-60) - G[G_ITEMPOPUP]); G[G_ITEMPOPUP_Y] = Clamp(G[G_ITEMPOPUP_Y], -16, 12); Screen->FastTile(6, G[G_ITEMPOPUP_X]-4, G[G_ITEMPOPUP_Y]-4, 63223, 11, OP_OPAQUE); for(int i = 0; i < G[G_ITEMPOPUP_LENGTH]; i++){ Screen->FastTile(6, G[G_ITEMPOPUP_X]+i, G[G_ITEMPOPUP_Y]-4, 63224, 11, OP_OPAQUE); } Screen->FastTile(6, G[G_ITEMPOPUP_X]+G[G_ITEMPOPUP_LENGTH], G[G_ITEMPOPUP_Y]-4, 63225, 11, OP_OPAQUE); Screen->DrawString(6, G[G_ITEMPOPUP_X], G[G_ITEMPOPUP_Y], FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, PickupString, OP_OPAQUE); if(G[G_ITEMPOPUP] > 256-(G[G_ITEMPOPUP_LENGTH]+8)) G[G_ITEMPOPUP] -= 3; G[G_ITEMPOPUP] --; if(G[G_ITEMPOPUP_Y] < -16) G[G_ITEMPOPUP] = 0; } else ClearString(PickupString); CountPlayTime(); ActiveSubscreen(); ActivateWeapon(); DrawButtonItems(); Link->PressStart = false; Link->InputStart = false; if((Link->PressMap || Link->InputMap) && !(Game->LItems[Game->GetCurLevel()] & LI_MAP)){ Link->PressMap = false; Link->InputMap = false; } ScrollingDraws_Update(); SwimDraw(); TabletDraw(); Waitdraw(); if(Link->HP<=0&&Game->DCounter[CR_LIFE]>0)Link->HP=1; Screen->Rectangle(7, 181, -17, 181+61*(Link->HP/Link->MaxHP), -12, 0x81, 1, 0, 0, 0, true, 128);//242, 129 Screen->Rectangle(7, 181, -17, 181+61*(Max(Link->HP-G[G_HPDRAIN], 0)/Link->MaxHP), -12, 0x82, 1, 0, 0, 0, true, 128);//242, 129 if(Game->Counter[CR_SCRIPT1]!=Link->HP){ Game->Counter[CR_SCRIPT1]=Link->HP; } G[G_ANIMATIONS] = (G[G_ANIMATIONS]+1)%360; if(G[G_GLOBALFRAMES] >= 9720) G[G_GLOBALFRAMES] = 0; G[G_GLOBALFRAMES]++; UpdateGhostZH2(); Tango_Update2(); AutoGhost(); DrawGhostFFCs(); G[G_LINKSPEED] = Floor(100*(1.5+LinkMovement_GetLinkSpeedBoost())/1.5); LinkMovement_Update26th(); SetEquipmentA(ITM_NULL); SetEquipmentB(ITM_NULLB); Waitframe(); } } } ffc script CrystalSwitch{ void run(){ if(G[G_BLOCKS] == 0) Screen->ComboD[ComboAt(this->X,this->Y)]++; while(true){ int state = G[G_BLOCKS]; if(GotHit(this)){ Game->PlaySound(SFX_SECRET); if(state == 0) G[G_BLOCKS] = 1; else G[G_BLOCKS] = 0; } //Waitdraw(); if(state != G[G_BLOCKS] ){ if(state) Screen->ComboD[ComboAt(this->X,this->Y)]--; else Screen->ComboD[ComboAt(this->X,this->Y)]++; int minframes = 40; while(GotHit(this)||minframes>0){ if(minframes>0) minframes--; Waitframe(); } } else Waitframe(); } } bool GotHit(ffc this){ bool hit; for(int i= Screen->NumLWeapons(); i > 0 && !hit; i--){ lweapon l = Screen->LoadLWeapon(i); if(l->ID == LW_SPARKLE) continue; if(l->ID == LW_FIRESPARKLE) continue; if(l->ID == LW_BOMB) continue; if(l->ID == LW_SBOMB) continue; if(l->ID == LW_BAIT) continue; if(l->ID == LW_FIRE) continue; if(l->ID == LW_WHISTLE) continue; if(l->DeadState > 0 && l->ID != LW_BRANG) continue; if(l->DeadState==WDS_NOHIT) continue; if(!l->CollDetection) continue; if(Collision(l, this)) hit = true; } return hit; } } void renderneck(int originx, int originy, int thisx, int thisy, int layer, int segcombo, int segcset, int numseg){ for(int i=0; i<=numseg; i++){ FastComboFix(layer, thisx+i*((originx-thisx)/(numseg)), thisy+i*((originy-thisy)/(numseg)), segcombo, segcset, 128); } } ffc script Ball_n_chain{ void run(int enemyid){ npc n = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_KNOCKBACK_4WAY); int Combo = n->Attributes[10]; Ghost_Transform(this, n, 1164, n->CSet, 1, 1); int angle=0; int tics=0; int negtics = 0; int maceid = n->Attributes[9]; npc mace=Screen->CreateNPC(maceid); npc mace2; if(n->Attributes[8] == 1) mace2=Screen->CreateNPC(maceid); while(true){ Ghost_MoveTowardLink(0.1, 1); mace->X=Ghost_X-6+VectorX(15+15*Sin(tics), angle); mace->Y=Ghost_Y-6+VectorY(15+15*Sin(tics), angle); renderneck(mace->X, mace->Y, this->X-6, this->Y-6, 1, 1165, n->CSet, 6); angle+=4+2*Sin(tics); tics++; if(n->Attributes[8] == 1){ angle+=4+2*Sin(negtics); negtics--; mace2->X=mace->X-6+VectorX(15+15*Sin(tics), angle*1.5); mace2->Y=mace->Y-6+VectorY(15+15*Sin(tics), angle*1.5); renderneck(mace2->X, mace2->Y, mace->X, mace->Y, 1, 1165, n->CSet, 6); } if(!Ghost_Waitframe(this, n, true, false)){ mace->HP=-1000; if(n->Attributes[8] == 1) mace2->HP=-1000; Quit(); } } } } ffc script BatEye{ void run(int enemyid){ int tics=0; npc n = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_MOVE_OFFSCREEN); Ghost_SetFlag(GHF_IGNORE_NO_ENEMY); int Combo = n->Attributes[10]; n->OriginalTile=GH_BLANK_TILE; Ghost_Transform(this, n, 1169, 7, 1, 1); while(Distance(Ghost_X, Ghost_Y, Link->X, Link->Y)>50){ Ghost_Waitframe(this, n, true, true); } Game->PlaySound(41); Ghost_Data=1168; int angle=Angle(Ghost_X, Ghost_Y, Link->X, Link->Y); while(true){ Ghost_MoveAtAngle(angle+20*Sin(10*tics), 1.4, 0); tics++; if(Ghost_X<-16||Ghost_X>256||Ghost_Y<-16||Ghost_Y>176)n->HP=-1000; Ghost_Waitframe(this, n, true, true); } } } ffc script Ghost{ void run(int startstep, int friction){ int combo=this->Data; while(true){ if(this->X>Link->X)this->Data=combo+1; else if(this->XX)this->Data=combo; int angle=Angle(this->X, this->Y, Link->X, Link->Y); if(Link->Action==LA_ATTACKING){ int step=startstep; while(step>0){ this->X+=VectorX(step, angle); this->Y+=VectorY(step, angle); step-=friction; Waitframe(); } } Waitframe(); } } } ffc script LttPDarkRoom{ void DrawLightCircle(int layer, int x, int y, int dir){ if(dir==0)DrawTileFix(layer, x, y, 59280, 6, 6, 7, -1, -1, 0, 0, 0, 0, true, 128); else if(dir==1)DrawTileFix(layer, x, y, 59280, 6, 6, 7, -1, -1, 0, 0, 0, 2, true, 128); else if(dir==2)DrawTileFix(layer, x, y, 59286, 6, 6, 7, -1, -1, 0, 0, 0, 1, true, 128); else if(dir==3)DrawTileFix(layer, x, y, 59286, 6, 6, 7, -1, -1, 0, 0, 0, 0, true, 128); Screen->Rectangle(layer, 0, 0, 256, y, 0, 1, 0, 0, 0, true, 128); Screen->Rectangle(layer, 0, 176, 256, y+96, 0, 1, 0, 0, 0, true, 128); Screen->Rectangle(layer, 0, y, x, y+96, 0, 1, 0, 0, 0, true, 128); Screen->Rectangle(layer, x+96, y, 256, y+96, 0, 1, 0, 0, 0, true, 128); } void run(){ while(true){ int xoffset=-40; int yoffset=-40; if(Link->Dir==DIR_UP)yoffset-=20; else if(Link->Dir==DIR_DOWN)yoffset+=20; else if(Link->Dir==DIR_RIGHT)xoffset+=20; else if(Link->Dir==DIR_LEFT)xoffset-=20; DrawLightCircle(6, Link->X+xoffset, Link->Y+yoffset, Link->Dir); Waitframe(); } } } ffc script Hopnut{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_NORMAL); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_4WAY); int Counter = -1; while(true){ Counter = Ghost_ConstantWalk4(Counter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger); if(Distance(Link->X, Link->Y, Ghost_X, Ghost_Y)<48&&Link->Action==LA_ATTACKING){ Ghost_Jump = 2; Game->PlaySound(SFX_JUMP); int Angle = Angle(Link->X, Link->Y, Ghost_X, Ghost_Y); while(Ghost_Z>0||Ghost_Jump>0){ Ghost_MoveAtAngle(Angle, ghost->Step/60, 0); Ghost_Dir = AngleDir4(Angle); Ghost_WaitframeCarryover(this, ghost); } Ghost_WaitframesCarryover(this, ghost, 2); } Ghost_WaitframeCarryover(this, ghost); } } } const int NPC_HEART = 257; ffc script MaskHeart{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); npc Body; for(int i=1; i<=Screen->NumNPCs(); i++){ npc n = Screen->LoadNPC(i); if(n->Misc[15]==0&&n->ID==NPC_HEART){ n->Misc[15] = 1; Body = n; break; } } while(true){ if(!Body->isValid()) Ghost_HP = 0; Ghost_Waitframe2(this, ghost, true, true); } } } //Rather Grouchy Frozen Fish Wizard Script void NoEnemyWalls(){ if(Game->GetCurLevel()>0&&!ScreenFlag(SF_ROOMTYPE, 2)){ int i; for(i=0; i<16; i++){ Screen->ComboF[i] = CF_NOENEMY; Screen->ComboF[16+i] = CF_NOENEMY; Screen->ComboF[144+i] = CF_NOENEMY; Screen->ComboF[160+i] = CF_NOENEMY; } for(i=0; i<7; i++){ Screen->ComboF[32+i*16] = CF_NOENEMY; Screen->ComboF[33+i*16] = CF_NOENEMY; Screen->ComboF[46+i*16] = CF_NOENEMY; Screen->ComboF[47+i*16] = CF_NOENEMY; } } } bool OnStairs(int X, int Y){ int warpcombos[] = {CT_STAIR, CT_STAIRB, CT_STAIRC, CT_STAIRD, CT_STAIRR}; for(int i=0; i<5; i++){ if(Screen->ComboT[ComboAt(X, Y)]==warpcombos[i]) return true; } return false; } void Ghost_WaitframeCarryover(ffc this, npc ghost){ if(Screen->Flags[SF_WARP]&10000b&&ghost->HP>0){ if(LeavingScreen()||OnStairs(Link->X+8, Link->Y+8)) this->Flags[FFCF_CARRYOVER] = false; else this->Flags[FFCF_CARRYOVER] = true; } else if(this->Flags[FFCF_CARRYOVER]) this->Flags[FFCF_CARRYOVER] = false; Ghost_Waitframe(this, ghost); } void Ghost_WaitframesCarryover(ffc this, npc ghost, int frames){ for(int i=0; iisSolid(X+x*7.5, Y+y*7.5)||IsWater(ComboAt(X+x*7.5, Y+y*7.5))) return true; } } return false; } ffc script Fissrobe{ bool InScreen(int X, int Y){ if(X>=32&&X<=208&&Y>=32&&Y<=128)return true; else return false; } void run(int enemyid){ NoEnemyWalls(); npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_NORMAL); Ghost_UnsetFlag(GHF_KNOCKBACK); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); int DashChance = ghost->Attributes[0]; int ShotCooldown = ghost->Attributes[1]; int DashCooldown = ghost->Attributes[2]; int AttackFreq = ghost->Attributes[3]; int Combo = ghost->Attributes[10]; Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1); int Counter; int AttackCooldown; while(true){ Counter = Ghost_ConstantWalk4(Counter, ghost->Step/2, ghost->Rate, ghost->Homing, ghost->Hunger); //Attack if(Rand(AttackFreq)==0&&AttackCooldown==0&&!Fishrobe_Phasing(Ghost_X, Ghost_Y, false)){ int Dir = Ghost_Dir; //Attack goes here Game->PlaySound(SFX_CHARGE1); Ghost_Data = Combo+8; Fishrobe_Waitframes(this, ghost, false, 90); Ghost_Data = Combo; eweapon EExplosions[9]; lweapon LExplosions[9]; int BoomAngle = -90; int Boomrot = Choose(-1, 1); for(int i=0; i<9; i++){ int a = i%3; int Row = Ceiling(i/2); if(!EExplosions[i]->isValid()){ EExplosions[i] = FireEWeapon(EW_BOMBBLAST, Ghost_X+VectorX(12*Row, BoomAngle+a*120), Ghost_Y+VectorY(12*Row, BoomAngle+a*120), 0, 0, ghost->WeaponDamage, -1, -1, 0); LExplosions[i] = CreateLWeaponAt(LW_BOMBBLAST, EExplosions[i]->X, EExplosions[i]->Y); LExplosions[i]->Damage = EExplosions[i]->Damage; } } for(int j=0; j<120; j++){ BoomAngle = WrapDegrees(BoomAngle+Boomrot*2); for(int i=0; i<9; i++){ int a = i%3; int Row = Ceiling(i/2); if(!EExplosions[i]->isValid()){ EExplosions[i] = FireEWeapon(EW_BOMBBLAST, Ghost_X+VectorX(12*Row, BoomAngle+a*120), Ghost_Y+VectorY(12*Row, BoomAngle+a*120), 0, 0, ghost->WeaponDamage, -1, -1, 0); if(LExplosions[i]->isValid()){ LExplosions[i]->DeadState = 0; } LExplosions[i] = CreateLWeaponAt(LW_BOMBBLAST, EExplosions[i]->X, EExplosions[i]->Y); LExplosions[i]->Damage = EExplosions[i]->Damage; } else{ EExplosions[i]->X = Ghost_X+VectorX(12*Row, BoomAngle+a*120); EExplosions[i]->Y = Ghost_Y+VectorY(12*Row, BoomAngle+a*120); if(!LExplosions[i]->isValid()){ LExplosions[i] = CreateLWeaponAt(LW_BOMBBLAST, EExplosions[i]->X, EExplosions[i]->Y); LExplosions[i]->Damage = EExplosions[i]->Damage; } } } Fishrobe_Waitframe(this, ghost, false); } //End Attack AttackCooldown = ShotCooldown; } //Diagonal Dash else if(Rand(DashChance)==0&&AttackCooldown==0){ int Angle = 45+90*Rand(0, 3); int Distance = 16*Rand(3, 5); int TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; int TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; int TargetCombo = ComboAt(TargetX, TargetY); for(int i=0; i<20&&!(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)); i++){ Angle = 45+90*Rand(0, 3); Distance = 16*Rand(3, 5); TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; TargetCombo = ComboAt(TargetX, TargetY); } if(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)){ Ghost_Data = Combo+4; Ghost_X = GridX(CenterX(ghost)); Ghost_Y = GridY(CenterY(ghost)); int Step = Min(ghost->Step, 400); for(int i=0; i0)AttackCooldown--; Fishrobe_Waitframe(this, ghost, false); } } } void Fishrobe_Waitframe(ffc this, npc ghost, bool alwaysphase){ if(Fishrobe_Phasing(Ghost_X, Ghost_Y, alwaysphase)&&G[G_ANIMATIONS]%2==0) ghost->DrawYOffset = -1000; else ghost->DrawYOffset = -2; if(ghost->Stun<=0&&!ClockIsActive()){ Ghost_WaitframeCarryover(this, ghost); } else{ while(ghost->Stun>0||ClockIsActive()){ if(Fishrobe_Phasing(Ghost_X, Ghost_Y, alwaysphase)&&G[G_ANIMATIONS]%2==0) ghost->DrawYOffset = -1000; else ghost->DrawYOffset = -2; Ghost_WaitframeCarryover(this, ghost); } } } void Fishrobe_Waitframes(ffc this, npc ghost, bool alwaysphase, int frames){ for(int i=0; iDrawYOffset = -1000; else ghost->DrawYOffset = -2; if(!ClockIsActive()){ Ghost_WaitframeCarryover(this, ghost); } else{ while(ClockIsActive()){ if(Fishrobe_Phasing(Ghost_X, Ghost_Y, alwaysphase)&&G[G_ANIMATIONS]%2==0) ghost->DrawYOffset = -1000; else ghost->DrawYOffset = -2; Ghost_WaitframeCarryover(this, ghost); } } } ffc script Firerobe3{ bool InScreen(int X, int Y){ if(X>=32&&X<=208&&Y>=32&&Y<=128)return true; else return false; } void run(int enemyid){ NoEnemyWalls(); npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_NORMAL); Ghost_UnsetFlag(GHF_KNOCKBACK); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); int DashChance = ghost->Attributes[0]; int ShotCooldown = ghost->Attributes[1]; int DashCooldown = ghost->Attributes[2]; int Combo = ghost->Attributes[10]; Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1); int Counter; int AttackCooldown = 120;; while(true){ Counter = Ghost_ConstantWalk4(Counter, ghost->Step/2, ghost->Rate, ghost->Homing, ghost->Hunger); //Attack if(__Ghost_LinedUp(8, false)==Ghost_Dir&&AttackCooldown==0&&!Fishrobe_Phasing(Ghost_X, Ghost_Y, false)){ int Dir = Ghost_Dir; //Attack goes here int FireX = Ghost_X; int FireY = Ghost_Y; int FireDir = Ghost_Dir; int FireA = DirAngle(Ghost_Dir)+180; for(int i=0; i<128&&FireX>-16&&FireX<256&&FireY>-16&&FireY<176; i++){ eweapon e = FireEWeapon(EW_FIRE, FireX+VectorX(8, FireA), FireY+VectorY(8, FireA), DegtoRad(FireA), 20, ghost->WeaponDamage, -1, -1, EWF_UNBLOCKABLE); e->CSet = Ghost_CSet; FireX += InFrontX(FireDir, 12); FireY += InFrontY(FireDir, 12); FireA = WrapDegrees(FireA+36); Fishrobe_Waitframes(this, ghost, false, 2); } //End Attack AttackCooldown = ShotCooldown; } //Diagonal Dash else if(Rand(DashChance)==0&&AttackCooldown==0){ //Dash fire effect for(int i=0; i<8; i++){ eweapon e = FireEWeapon(EW_FIRE, Ghost_X, Ghost_Y, DegtoRad(45*i), 60, ghost->WeaponDamage, -1, -1, 0); e->CSet = Ghost_CSet; } //end dash fire effect int Angle = 45+90*Rand(0, 3); int Distance = 16*Rand(3, 5); int TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; int TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; int TargetCombo = ComboAt(TargetX, TargetY); for(int i=0; i<20&&!(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)); i++){ Angle = 45+90*Rand(0, 3); Distance = 16*Rand(3, 5); TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; TargetCombo = ComboAt(TargetX, TargetY); } if(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)){ Ghost_Data = Combo+4; Ghost_X = GridX(CenterX(ghost)); Ghost_Y = GridY(CenterY(ghost)); int Step = Min(ghost->Step, 400); for(int i=0; i0)AttackCooldown--; Fishrobe_Waitframe(this, ghost, false); } } } ffc script Hookrobe{ bool InScreen(int X, int Y){ if(X>=32&&X<=208&&Y>=32&&Y<=128)return true; else return false; } void run(int enemyid){ NoEnemyWalls(); npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); int DashChance = ghost->Attributes[0]; int ShotCooldown = ghost->Attributes[1]; int DashCooldown = ghost->Attributes[2]; int AttackFreq = ghost->Attributes[3]; int Combo = ghost->Attributes[10]; Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1); int Counter; int AttackCooldown; while(true){ Counter = Ghost_ConstantWalk4(Counter, ghost->Step/2, ghost->Rate, ghost->Homing, ghost->Hunger); //Attack if(Rand(AttackFreq)==0&&AttackCooldown==0&&!Fishrobe_Phasing(Ghost_X, Ghost_Y, false)){ int Dir = Ghost_Dir; //Attack goes here int HookX[5]; int HookY[5]; int HookA[5]; int HookState[5]; bool HookValid[5]; int GrabbedLink = -1; npc Grabbed[5]; int Hooks = 5; int i; int j; int k; for(i=0; i<5; i++){ if(i==0) HookA[i] = Angle(Ghost_X, Ghost_Y, Link->X, Link->Y); else HookA[i] = Rand(360); HookX[i] = Ghost_X+8+VectorX(8, HookA[i]); HookY[i] = Ghost_Y+8+VectorY(8, HookA[i]); HookValid[i] = true; } for(i=0; i<40; i++){ for(j=0; j<5; j++){ DrawTile(2, HookX[j], HookY[j], 47725, 1, 1, 7, -1, -1, HookX[j], HookY[j], HookA[j], 0, true, 128); } ghost->Stun = 10; Fishrobe_WaitframeAlt(this, ghost, false); } int SFXCounter; while(Hooks>0){ SFXCounter = (SFXCounter+1)%360; if(SFXCounter%8==0){ Game->PlaySound(17); } for(j=0; j<5; j++){ if(HookValid[j]){ if(HookState[j]==0){ HookX[j] += VectorX(4, HookA[j]); HookY[j] += VectorY(4, HookA[j]); for(k=1; k<=Screen->NumNPCs()&&k<=10; k++){ npc n = Screen->LoadNPC(k); if(RectCollision(HookX[j]-4, HookY[j]-4, HookX[j]+4, HookY[j]+4, n->X+n->HitXOffset, n->Y+n->HitYOffset, n->X+n->HitXOffset+n->HitWidth, n->Y+n->HitYOffset+n->HitHeight)){ if(n->Attributes[11]==0){ Grabbed[j] = n; HookState[j] = 1; break; } } } if(RectCollision(HookX[j]-4, HookY[j]-4, HookX[j]+4, HookY[j]+4, Link->X+2, Link->Y+2, Link->X+13, Link->Y+13)&&Link->Action!=LA_GOTHURTLAND&&!Link->Invisible&&Link->CollDetection){ GrabbedLink = j; HookState[j] = 1; } if(HookX[j]<32||HookX[j]>224||HookY[j]<32||HookY[j]>144){ HookState[j] = 1; } for(k=0; kisValid()){ Grabbed[j]->X = HookX[j]-Grabbed[j]->HitWidth/2-Grabbed[j]->HitXOffset; Grabbed[j]->Y = HookY[j]-Grabbed[j]->HitHeight/2-Grabbed[j]->HitYOffset; } for(k=0; kX = HookX[j]-8; Link->Y = HookY[j]-8; Link->Z = 2; } if(Distance(HookX[j], HookY[j], Ghost_X+8, Ghost_Y+8)<4){ if(j==GrabbedLink){ Link->X = Ghost_X; Link->Y = Ghost_Y; } HookValid[j] = false; Hooks--; } DrawTile(2, HookX[j], HookY[j], 47725, 1, 1, 7, -1, -1, HookX[j], HookY[j], HookA[j], 0, true, 128); } } } ghost->Stun = 10; Fishrobe_WaitframeAlt(this, ghost, false); } //End Attack AttackCooldown = ShotCooldown; } //Diagonal Dash else if(Rand(DashChance)==0&&AttackCooldown==0){ int Angle = 45+90*Rand(0, 3); int Distance = 16*Rand(3, 5); int TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; int TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; int TargetCombo = ComboAt(TargetX, TargetY); for(int i=0; i<20&&!(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)); i++){ Angle = 45+90*Rand(0, 3); Distance = 16*Rand(3, 5); TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; TargetCombo = ComboAt(TargetX, TargetY); } if(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)){ Ghost_Data = Combo+4; Ghost_X = GridX(CenterX(ghost)); Ghost_Y = GridY(CenterY(ghost)); int Step = Min(ghost->Step, 400); for(int i=0; iStun = 10; Fishrobe_WaitframeAlt(this, ghost, true); } Ghost_Data = Combo; Ghost_X = ComboX(TargetCombo); Ghost_Y = ComboY(TargetCombo); AttackCooldown = DashCooldown; } } if(AttackCooldown>0)AttackCooldown--; ghost->Stun = 10; Fishrobe_WaitframeAlt(this, ghost, false); } } } const int C_PIERCEROBE1 = 0x81; const int C_PIERCEROBE2 = 0x82; const int C_PIERCEROBE3 = 0x83; //DoubleLaser3Color(int layer, int x, int y, int width, int rotation, int damage, int color1, int color2, int color3){ ffc script Piercerobe{ void Piercerobe_Waitframe(ffc this, npc ghost, int laserwidth, bool teleporting, bool draw){ int Combo = ghost->Attributes[10]; if(draw&&(!teleporting||G[G_ANIMATIONS]%2==0)){ FastComboFix(2, Ghost_X, Ghost_Y, Combo+Ghost_Dir, this->CSet, 128); if(laserwidth>0){ int lx; int ly; int la; if(Ghost_Dir==DIR_UP){ lx = 8; ly = 6; la = 90; } else if(Ghost_Dir==DIR_DOWN){ lx = 9; ly = 6; la = 90; } else if(Ghost_Dir==DIR_LEFT){ lx = 6; ly = 6; la = 0; } else if(Ghost_Dir==DIR_RIGHT){ lx = 10; ly = 6; la = 0; } DoubleLaser3Color(2, Ghost_X+lx, Ghost_Y+ly, laserwidth, la, ghost->WeaponDamage, C_PIERCEROBE1, C_PIERCEROBE2, C_PIERCEROBE3); } FastComboFix(2, Ghost_X, Ghost_Y, Combo+4+Ghost_Dir, this->CSet, 128); // if(Ghost_WasFrozen()){ // Ghost_Data = Combo+4+Ghost_Dir; // Waitframe(); // } // else // Ghost_Data = GH_INVISIBLE_COMBO; } Ghost_Waitframe(this, ghost); } void Piercerobe_Teleport(ffc this, npc ghost, int frames, int imprecision){ for(int i=0; i<20; i++){ Piercerobe_Waitframe(this, ghost, 0, true, true); } ghost->CollDetection = false; for(int i=0; iX, Link->Y)<40); i++){ if(i<176) targetcombo = Rand(176); else targetcombo = i-176; } Ghost_X = ComboX(targetcombo); Ghost_Y = ComboY(targetcombo); ghost->CollDetection = true; for(int i=0; i<20; i++){ Piercerobe_Waitframe(this, ghost, 0, true, true); } } void run(int enemyid){ NoEnemyWalls(); npc ghost = Ghost_InitAutoGhost(this, enemyid); int TeleportFrames = ghost->Attributes[0]; int TeleportImprecision = ghost->Attributes[1]; int ShotDelay = ghost->Attributes[2]; Ghost_Data = GH_INVISIBLE_COMBO; Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); Ghost_Y = -32; while(true){ Piercerobe_Teleport(this, ghost, TeleportFrames, TeleportImprecision); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); for(int i=0; iPlaySound(72); for(int i=0; i<3; i++){ Piercerobe_Waitframe(this, ghost, i, false, true); } for(int i=0; i<20; i++){ Piercerobe_Waitframe(this, ghost, 3, false, true); } for(int i=3; i>0; i--){ Piercerobe_Waitframe(this, ghost, i, false, true); } } } } ffc script Batrobe{ int Batrobe_Summon(ffc this, npc ghost, int Vars, npc Summons){ int SummonX = Vars[0]; int SummonY = Vars[1]; int SummonVX = Vars[2]; int SummonVY = Vars[3]; int SummonNPC = ghost->Attributes[3]; int MaxSummon = ghost->Attributes[6]; for(int i=0; iisValid()){ SummonX[i] = Ghost_X; SummonY[i] = Ghost_Y; Summons[i] = CreateNPCAt(SummonNPC, SummonX[i], SummonY[i]); return i; } } return -1; } void Batrobe_Waitframe(ffc this, npc ghost, int Vars, npc Summons, bool teleporting, bool draw){ int i; int SummonX = Vars[0]; int SummonY = Vars[1]; int SummonVX = Vars[2]; int SummonVY = Vars[3]; int SummonNPC = ghost->Attributes[3]; int NumSummonMin = ghost->Attributes[4]; int NumSummonMax = ghost->Attributes[5]; int MaxSummon = ghost->Attributes[6]; int SummonAccel = ghost->Attributes[7]/100; int SummonMaxV = ghost->Attributes[8]/100; int Combo = ghost->Attributes[10]; for(i=0; iisValid()){ Summons[i]->Jump = 0; if(Summons[i]->HP>0){ SummonVX[i] = Clamp(SummonVX[i]+Sign(Link->X-SummonX[i])*SummonAccel, -SummonMaxV, SummonMaxV); SummonVY[i] = Clamp(SummonVY[i]+Sign(Link->Y-SummonY[i])*SummonAccel, -SummonMaxV, SummonMaxV); SummonX[i] = SummonX[i]+SummonVX[i]; SummonY[i] = SummonY[i]+SummonVY[i]; Summons[i]->X = SummonX[i]; Summons[i]->Y = SummonY[i]; } } } if(draw&&(!teleporting||G[G_ANIMATIONS]%2==0)){ FastComboFix(2, Ghost_X, Ghost_Y, Combo+Ghost_Dir, this->CSet, 128); } Ghost_WaitframeCarryover(this, ghost); } void Batrobe_Teleport(ffc this, npc ghost, int Vars, npc Summons, int frames, int imprecision){ for(int i=0; i<20; i++){ Batrobe_Waitframe(this, ghost, Vars, Summons, true, true); } ghost->CollDetection = false; for(int i=0; iX, Link->Y)<40); i++){ if(i<176) targetcombo = Rand(176); else targetcombo = i-176; } Ghost_X = ComboX(targetcombo); Ghost_Y = ComboY(targetcombo); ghost->CollDetection = true; for(int i=0; i<20; i++){ Batrobe_Waitframe(this, ghost, Vars, Summons, true, true); } } void run(int enemyid){ NoEnemyWalls(); npc ghost = Ghost_InitAutoGhost(this, enemyid); int TeleportFrames = ghost->Attributes[0]; int TeleportImprecision = ghost->Attributes[1]; int ShotDelay = ghost->Attributes[2]; int SummonNPC = ghost->Attributes[3]; int NumSummonMin = ghost->Attributes[4]; int NumSummonMax = ghost->Attributes[5]; int MaxSummon = ghost->Attributes[6]; int SummonAccel = ghost->Attributes[7]/100; int SummonMaxV = ghost->Attributes[8]/100; Ghost_Data = GH_INVISIBLE_COMBO; Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); npc Summons[64]; int SummonX[64]; int SummonY[64]; int SummonVX[64]; int SummonVY[64]; int Vars[16] = {SummonX, SummonY, SummonVX, SummonVY}; Ghost_Y = -32; while(true){ Batrobe_Teleport(this, ghost, Vars, Summons, TeleportFrames, TeleportImprecision); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); for(int i=0; iPlaySound(SFX_SUMMON); int summoncount = Rand(NumSummonMin, NumSummonMax); for(int i=0; i-1){ int angle = Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)+Rand(-30, 30); SummonVX[i] = VectorX(SummonMaxV/2, angle); SummonVY[i] = VectorY(SummonMaxV/2, angle); } } for(int i=0; iX+8, Link->Y+8))==98){ Screen->FastTile(6, Link->X+Link->DrawXOffset, Link->Y+Link->DrawYOffset, Link->Tile, 6, 64); } for(int i=1; i<=Screen->NumNPCs(); i++){ npc n = Screen->LoadNPC(i); if(GetLayerComboF(1, ComboAt(CenterX(n), CenterY(n)))==98&&n->HP>0&&n->HitXOffset<1000){ if(n->ID>=20&&n->ID<=23){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5632+n->Dir, n->CSet, 64); } else if(n->ID==28||n->ID==29||n->ID==192){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5636+n->Dir, n->CSet, 64); } else if(n->ID==44||n->ID==80){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5640+n->Dir, n->CSet, 64); } else if(n->ID==32){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5644, n->CSet, 64); } else if(n->ID==49||n->ID==50||n->ID==235||n->ID==92){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5648+n->Dir, n->CSet, 64); } else if(n->ID==30||n->ID==31||n->ID==229){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5652+n->Dir, n->CSet, 64); } else if(n->ID==35){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 5656+n->Dir, n->CSet, 64); } else if(n->ID==257){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 2788+n->Dir, n->CSet, 64); } else if(n->ID==256){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 2784+n->Dir, n->CSet, 64); } else if(n->ID==255){ Screen->FastCombo(6, n->X+n->DrawXOffset, n->Y+n->DrawYOffset, 2464+n->Dir, n->CSet, 64); } else{ DrawToLayer(n, 6, 64); } } } for(int i=1; i<=Screen->NumEWeapons(); i++){ eweapon e = Screen->LoadEWeapon(i); if(GetLayerComboF(1, ComboAt(CenterX(e), CenterY(e)))==98){ DrawToLayer(e, 6, 64); } } } Waitframe(); } } } const int CMB_SPINNER = 4068; //D0: Screen->D[] to use //D1: DBit (0-15) to use //D2: DBit (1-15) to invert the initial state of the spinner ffc script Spinner{ void run(int d, int dbit, int invertdbit){ dbit = (1<D[d]&invertdbit)){ Screen->D[d] |= dbit; Screen->D[d] |= invertdbit; } } while(true){ // while(Distance(this->X+16, this->Y+16, Link->X, Link->Y)>16){ // Spinner_Waitframe(this, d, dbit); // } if(Distance(this->X+16, this->Y+16, Link->X, Link->Y)<=16){ int angleLink = Angle(this->X+16, this->Y+16, Link->X, Link->Y); int distLink = Distance(this->X+16, this->Y+16, Link->X, Link->Y); int tempAngleLink; for(int i=0; i<30; i++){ if(i%4==0) Game->PlaySound(1); if(!(Screen->D[d]&dbit)){ angleLink += 3; angleLink = WrapDegrees(angleLink); Screen->DrawCombo(2, this->X, this->Y, CMB_SPINNER+1+Clamp(Floor(i/10), 0, 2), 3, 3, 8, -1, -1, 0, 0, 0, -1, 0, true, 128); } else{ angleLink -= 3; angleLink = WrapDegrees(angleLink); Screen->DrawCombo(2, this->X, this->Y, CMB_SPINNER+1+Clamp(Floor((30-i)/10), 0, 2), 3, 3, 7, -1, -1, 0, 0, 0, -1, 0, true, 128); } tempAngleLink = Round((angleLink+360)/22.5)*22.5; Link->X = this->X+16+VectorX(distLink, tempAngleLink); Link->Y = this->Y+16+VectorY(distLink, tempAngleLink); for(int j = 1; j<=32; j++){ ffc f = Screen->LoadFFC(j); if(f->Script == 11 && Distance(this->X+16, this->Y+16, f->X, f->Y)<=16){ f->Misc[0] = 10; //Command to pause } } WaitNoAction(); } if(!(Screen->D[d]&dbit)) Screen->D[d] |= dbit; else Screen->D[d] &= ~dbit; while(Distance(this->X+16, this->Y+16, Link->X, Link->Y)<24){ for(int j = 1; j<=32; j++){ ffc f = Screen->LoadFFC(j); if(f->Script == 11 && Distance(this->X+16, this->Y+16, f->X, f->Y)<=16){ f->Misc[0] = 10; //Command to pause } } Spinner_Waitframe(this, d, dbit); } } for(int j = 1; j<=32; j++){ ffc f = Screen->LoadFFC(j); if(f->Script == 11 && Distance(this->X+16, this->Y+16, f->X, f->Y)<=16){ f->Misc[0] = 10; //Command to pause int angleLink = Angle(this->X+16, this->Y+16, f->X, f->Y); int distf = Distance(this->X+16, this->Y+16, f->X, f->Y); int tempAnglef; for(int i=0; i<30; i++){ if(i%4==0) Game->PlaySound(1); if(!(Screen->D[d]&dbit)){ angleLink += 3; angleLink = WrapDegrees(angleLink); Screen->DrawCombo(2, this->X, this->Y, CMB_SPINNER+1+Clamp(Floor(i/10), 0, 2), 3, 3, 8, -1, -1, 0, 0, 0, -1, 0, true, 128); } else{ angleLink -= 3; angleLink = WrapDegrees(angleLink); Screen->DrawCombo(2, this->X, this->Y, CMB_SPINNER+1+Clamp(Floor((30-i)/10), 0, 2), 3, 3, 7, -1, -1, 0, 0, 0, -1, 0, true, 128); } tempAnglef = Round((angleLink+360)/22.5)*22.5; f->X = this->X+16+VectorX(distf, tempAnglef); f->Y = this->Y+16+VectorY(distf, tempAnglef); Waitframe(); } if(!(Screen->D[d]&dbit)) Screen->D[d] |= dbit; else Screen->D[d] &= ~dbit; angleLink = Angle(this->X+16, this->Y+16, f->X, f->Y); f->Misc[0] = AngleDir4(angleLink) + 1; f->Misc[1] = 0; while(Distance(this->X+16, this->Y+16, f->X, f->Y)<24){ Spinner_Waitframe(this, d, dbit); } } } Spinner_Waitframe(this, d, dbit); } } void Spinner_Waitframe(ffc this, int d, int dbit){ if(!(Screen->D[d]&dbit)){ Screen->FastCombo(2, this->X+16, this->Y, CMB_SPINNER+4, 8, 128); Screen->FastCombo(2, this->X+16, this->Y+32, CMB_SPINNER+5, 8, 128); Screen->FastCombo(2, this->X, this->Y+16, CMB_SPINNER+6, 8, 128); Screen->FastCombo(2, this->X+32, this->Y+16, CMB_SPINNER+7, 8, 128); Screen->DrawCombo(2, this->X, this->Y, CMB_SPINNER, 3, 3, 8, -1, -1, 0, 0, 0, -1, 0, true, 128); } else{ Screen->FastCombo(2, this->X+16, this->Y, CMB_SPINNER+8, 7, 128); Screen->FastCombo(2, this->X+16, this->Y+32, CMB_SPINNER+9, 7, 128); Screen->FastCombo(2, this->X, this->Y+16, CMB_SPINNER+10, 7, 128); Screen->FastCombo(2, this->X+32, this->Y+16, CMB_SPINNER+11, 7, 128); Screen->DrawCombo(2, this->X, this->Y, CMB_SPINNER, 3, 3, 7, -1, -1, 0, 0, 0, -1, 0, true, 128); } Waitframe(); } } ffc script D_Reset{ void run(int d, int screen){ // if(Distance(Link->X, Link->Y, this->X, this->Y)<24){ if(screen!= 0){ if(d<0){ for(int j=Abs(d); j>=0; j--){ for(int i=0; i<128; i++){ Game->SetScreenD(screen, j, 0); } } } else{ for(int i=0; i<128; i++){ Game->SetScreenD(screen, d, 0); } } } else{ if(d<0){ for(int j=Abs(d); j>=0; j--){ for(int i=0; i<128; i++){ Game->SetScreenD(i, j, 0); } } } else{ for(int i=0; i<128; i++){ Game->SetScreenD(i, d, 0); } } } // } } } ffc script Conveyor{ void run(int flag, int initspeed){ while(true){ int speed = initspeed; if(initspeed == 1) speed = 1.5; int cmb=ComboAt(Link->X+8, Link->Y+12); int cmbt = Screen->ComboT[cmb]; if(Screen->ComboF[cmb]==flag||Screen->ComboI[cmb]==flag){ if(cmbt == CT_SCRIPT1) //Up LinkMovement_Push(0, -1*speed); else if (cmbt == CT_SCRIPT2) //Down LinkMovement_Push(0, 1*speed); else if (cmbt == CT_SCRIPT3) //Left LinkMovement_Push(-1*speed, 0); else if (cmbt == CT_SCRIPT4) //Right LinkMovement_Push(1*speed, 0); } if(Screen->ComboF[cmb]==flag+1||Screen->ComboI[cmb]==flag+1){ if(cmbt == CT_SCRIPT1){ //Leftup LinkMovement_Push(0, -1*speed*0.7071); LinkMovement_Push(-1*speed*0.7071, 0); } else if (cmbt == CT_SCRIPT2){ //Rightup LinkMovement_Push(0, -1*speed*0.7071); LinkMovement_Push(1*speed*0.7071, 0); } else if (cmbt == CT_SCRIPT3){ //Leftdown LinkMovement_Push(0, 1*speed*0.7071); LinkMovement_Push(-1*speed*0.7071, 0); } else if (cmbt == CT_SCRIPT4){ //Rightdown LinkMovement_Push(0, 1*speed*0.7071); LinkMovement_Push(1*speed*0.7071, 0); } } if(G[G_GLOBALFRAMES]%2==0){ for(int i = Screen->NumItems(); i>0; i--){ item tem = Screen->LoadItem(i); if(tem->Z == 0){ cmb=ComboAt(tem->X+8, tem->Y+8); cmbt = Screen->ComboT[cmb]; if((Screen->ComboF[cmb]==flag||Screen->ComboI[cmb]==flag) && !GetLayerComboS(1,cmb)){ if(cmbt == CT_SCRIPT1) //Up tem->Y--; else if (cmbt == CT_SCRIPT2) //Down tem->Y++; else if (cmbt == CT_SCRIPT3) //Left tem->X--; else if (cmbt == CT_SCRIPT4) //Right tem->X++; } } } } Waitframe(); } } } void DamageAndSpeed(){ G[G_DAMAGE_MULTIPLIER] = 8; G[G_WEAPON_MULTIPLIER] = 100; if((G[G_STATSRANDO] == 1 || G[G_STATSRANDO] == 3) && !Link->Item[RING_RIGGS]){ G[G_DAMAGE_MULTIPLIER] = G[G_KELLDEFENSE]; G[G_WEAPON_MULTIPLIER] = G[G_KELLATTACK]; if(!(G[G_ITEMPOPUP] > 0 && G[G_ITEMPOPUPTYPE] == 1)) LinkMovement_AddLinkSpeedBoost(G[G_KELLSPEED]); } if((G[G_STATSRANDO] == 2 || G[G_STATSRANDO] == 3) && Link->Item[RING_RIGGS]){ G[G_DAMAGE_MULTIPLIER] = G[G_RIGGSDEFENSE]; G[G_WEAPON_MULTIPLIER] = G[G_RIGGSATTACK]; if(!(G[G_ITEMPOPUP] > 0 && G[G_ITEMPOPUPTYPE] == 1)) LinkMovement_AddLinkSpeedBoost(G[G_RIGGSSPEED]); } if(G[G_DIFFICULTY] == DIF_VHARD){ G[G_DAMAGE_MULTIPLIER] *= 2; //Double Damage G[G_WEAPON_MULTIPLIER] *= 0.85; //Attack reduction } else if(G[G_DIFFICULTY] == DIF_HARD) G[G_DAMAGE_MULTIPLIER] *= 1.5; else if(G[G_DIFFICULTY] == DIF_EASY) G[G_DAMAGE_MULTIPLIER] *= 0.625; //+75% DEF else if(G[G_DIFFICULTY] == DIF_VEASY) G[G_DAMAGE_MULTIPLIER] *= 0.375; //+150% DEF if(G[G_NUMOFFENSE] == 1) G[G_WEAPON_MULTIPLIER] *= 1.25; //+25% ATK else if(G[G_NUMOFFENSE] == 2) G[G_WEAPON_MULTIPLIER] *= 1.5; //+50% ATK else if(G[G_NUMOFFENSE] == 3) G[G_WEAPON_MULTIPLIER] *= 1.75; //+75% ATK else if(G[G_NUMOFFENSE] >= 4) G[G_WEAPON_MULTIPLIER] *= 2; //+100% ATK if(G[G_NUMDEFENSE] == 1) G[G_DAMAGE_MULTIPLIER] *= 0.87; //+25% DEF else if(G[G_NUMDEFENSE] == 2) G[G_DAMAGE_MULTIPLIER] *= 0.75; //+50% DEF else if(G[G_NUMDEFENSE] == 3) G[G_DAMAGE_MULTIPLIER] *= 0.625;//+75% DEF else if(G[G_NUMDEFENSE] >= 4) G[G_DAMAGE_MULTIPLIER] *= .5; //+100% DEF if(G[G_STATSRANDO] == 0){ if(Link->Item[RING_RIGGS] || Link->Item[RING_ALIYA]){ if(!(G[G_ITEMPOPUP] > 0 && G[G_ITEMPOPUPTYPE] == 1)) LinkMovement_AddLinkSpeedBoost(0.35); G[G_DAMAGE_MULTIPLIER] *= 1.25; //-18% DEF } } if(G[G_DEFCURSE] > 0){ G[G_DAMAGE_MULTIPLIER] *= 2; //Double Damage G[G_DEFCURSE]--; } if(G[G_DEFCURSEAPP] > 0){ G[G_DEFCURSEAPP]--; if(G[G_DEFCURSEAPP] == 0) G[G_DEFCURSE] = 300; } if(Link->HP < G[G_LINK_CURRENT_HP]){ if(Link->Item[RING_ALIYA]) Game->PlaySound(111); else if(Link->Item[RING_RIGGS]) Game->PlaySound(113); else Game->PlaySound(112); int damagetaken = G[G_LINK_CURRENT_HP] - Link->HP; if(damagetaken >0){ Link->HP += damagetaken; G[G_HPDRAIN] += Clamp(damagetaken*G[G_DAMAGE_MULTIPLIER], 4, Link->MaxHP); } if(Link->HP - G[G_HPDRAIN] <= 0){ G[G_HPDRAINPENALTY]++; } } if(G[G_HPDRAIN] > 0 && G[G_GLOBALFRAMES] % G[G_HPDRAINMODULO] == 0 && G[G_SUBSCREENOPEN] == 0 && !(G[G_ITEMPOPUP] > 0 && G[G_ITEMPOPUPTYPE] == 1)){ G[G_HPDRAIN]--; Link->HP-=1; // G[G_LINK_CURRENT_HP]-=1; } Link->HP -= G[G_LINK_DIRECTDAMAGE]; G[G_LINK_DIRECTDAMAGE] = 0; G[G_LINK_CURRENT_HP] = Link->HP; } //Copied from Yuurand modified //P2 elements left intact but commented out in case I add multiplayer functionality at a later date ffc script ZeldaSword{ void run(int mpcost, int damage, int sprite, int sound, int slash, int attacker, int upgrade){ if(G[G_FISHORBACTIVE] == 1) G[G_FISHORBDROP] = 1; int SwordProperties[6]; int TridentProperties[6]; Game->PlaySound(sound); int frames; int Tile; int Flip; int TridentTile; int CSet; int InitTile; if(slash == I_FALSE){ while(frames <5){ frames++; DrawLinkAttacking(this, false, attacker); NoMovementWaitframesAttackerBased(1, attacker); } DrawLinkAttacking(this, false, attacker); int swordx; int swordy; int tridentx; int tridenty; if(attacker == 0){ if(Link->Dir == DIR_UP){ SwordProperties[0] = -1; SwordProperties[1] = -10; } if(Link->Dir == DIR_DOWN){ SwordProperties[0] = 1; SwordProperties[1] = 14; } if(Link->Dir == DIR_LEFT){ SwordProperties[0] = -11; SwordProperties[1] = 3; } if(Link->Dir == DIR_RIGHT){ SwordProperties[0] = 11; SwordProperties[1] = 3; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // swordx = G[G_PLAYER_TWO_X]-1; // swordy = G[G_PLAYER_TWO_Y]-10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // swordx = G[G_PLAYER_TWO_X]+1; // swordy = G[G_PLAYER_TWO_Y]+14; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // swordx = G[G_PLAYER_TWO_X]-11; // swordy = G[G_PLAYER_TWO_Y]+3; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // swordx = G[G_PLAYER_TWO_X]+11; // swordy = G[G_PLAYER_TWO_Y]+3; // } // } lweapon trident; lweapon sword = CreateLWeaponAt(LW_MAGIC, Clamp(swordx,5,234), Clamp(swordy,5,154)); sword->Step = 0; sword->Dir = Link->Dir; // if(attacker == 1) // sword->Dir = G[G_PLAYER_TWO_DIR]; sword->UseSprite(129); sword->Damage = damage*G[G_WEAPON_MULTIPLIER]; // SwordProperties[0] = sword->X-Link->X; // SwordProperties[1] = sword->Y-Link->Y; // if(attacker == 1){ // SwordProperties[0] = sword->X-G[G_PLAYER_TWO_X]; // SwordProperties[1] = sword->Y-G[G_PLAYER_TWO_Y]; // } Tile = 19820; if(sprite == 126) Tile = 19840; CSet = 7; Flip = 0; SwordProperties[2] = sword->Damage; SwordProperties[3] = Tile; if(attacker == 0){ if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT) SwordProperties[3]++; if(Link->Dir == DIR_DOWN) Flip = 3; if(Link->Dir == DIR_LEFT) Flip = 1; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT || G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // SwordProperties[3]++; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // Flip = 3; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // Flip = 1; // } Tile = SwordProperties[3]; UpdateSword(sword, SwordProperties, attacker); if(upgrade == 1){ if(attacker == 0){ if(Link->Dir == DIR_UP){ // tridenty = swordy-16; TridentProperties[1] = SwordProperties[1]-16; TridentProperties[0] = SwordProperties[0]; } if(Link->Dir == DIR_DOWN){ // tridenty = swordy+16; TridentProperties[1] = SwordProperties[1]+16; TridentProperties[0] = SwordProperties[0]; } if(Link->Dir == DIR_LEFT){ // tridentx = swordx-16; TridentProperties[0]=SwordProperties[0]-16; TridentProperties[1] = SwordProperties[1]; } if(Link->Dir == DIR_RIGHT){ // tridentx = swordx+16; TridentProperties[0] = SwordProperties[0]+16; TridentProperties[1] = SwordProperties[1]; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // swordy-=16; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // swordy+=16; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // swordx-=16; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // swordx-=16; // } // } trident = CreateLWeaponAt(LW_MAGIC, Clamp(tridentx,5,234), Clamp(tridenty,5,154)); trident->Step = 0; trident->Dir = Link->Dir; // if(attacker == 1) // sword->Dir = G[G_PLAYER_TWO_DIR]; trident->UseSprite(129); trident->Damage = damage*G[G_WEAPON_MULTIPLIER]; // TridentProperties[0] = trident->X-Link->X; // TridentProperties[1] = trident->Y-Link->Y; // if(attacker == 1){ // TridentProperties[0] = sword->X-G[G_PLAYER_TWO_X]; // TridentProperties[1] = sword->Y-G[G_PLAYER_TWO_Y]; // } TridentTile = 19860; TridentProperties[2] = trident->Damage; TridentProperties[3] = TridentTile; if(attacker == 0){ if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT) TridentProperties[3]++; if(Link->Dir == DIR_DOWN) trident->Flip = 3; if(Link->Dir == DIR_LEFT) trident->Flip = 1; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT || G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // TridentProperties[3]++; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // trident->Flip = 3; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // trident->Flip = 1; // } TridentTile = TridentProperties[3]; UpdateSword(trident, TridentProperties, attacker); } while(frames <12){ if(frames == 7 || frames == 11){ if(Link->InputUp){ if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT){ SwordProperties[3]--; Tile--; } Flip = 0; SwordProperties[0] = -1; SwordProperties[1] = -10; if(upgrade==1){ if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT){ TridentProperties[3]--; TridentTile--; } TridentProperties[1] = SwordProperties[1]-16; TridentProperties[0] = SwordProperties[0]; trident->Dir = DIR_UP; } Link->Dir = DIR_UP; sword->Dir = Link->Dir; } else if(Link->InputDown){ if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT){ SwordProperties[3]--; Tile--; } Flip = 3; SwordProperties[0] = 1; SwordProperties[1] = 14; if(upgrade==1){ if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT){ TridentProperties[3]--; TridentTile--; } TridentProperties[1] = SwordProperties[1]+16; TridentProperties[0] = SwordProperties[0]; trident->Dir = DIR_DOWN; } Link->Dir = DIR_DOWN; sword->Dir = Link->Dir; } else if(Link->InputLeft){ if(Link->Dir == DIR_UP || Link->Dir == DIR_DOWN){ SwordProperties[3]++; Tile++; } Flip = 1; SwordProperties[0] = -11; SwordProperties[1] = 3; if(upgrade==1){ if(Link->Dir == DIR_UP || Link->Dir == DIR_DOWN){ TridentProperties[3]++; TridentTile++; } TridentProperties[1] = SwordProperties[1]; TridentProperties[0] = SwordProperties[0]-16; trident->Dir = DIR_LEFT; } Link->Dir = DIR_LEFT; sword->Dir = Link->Dir; } else if(Link->InputRight){ if(Link->Dir == DIR_UP || Link->Dir == DIR_DOWN){ SwordProperties[3]++; Tile++; } sword->Dir = Link->Dir; Flip = 0; SwordProperties[0] = 11; SwordProperties[1] = 3; if(upgrade==1){ if(Link->Dir == DIR_UP || Link->Dir == DIR_DOWN){ TridentProperties[3]++; TridentTile++; } TridentProperties[1] = SwordProperties[1]; TridentProperties[0] = SwordProperties[0]+16; trident->Dir = DIR_RIGHT; } Link->Dir = DIR_RIGHT; sword->Dir = Link->Dir; } } // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); if(upgrade == 1){ // Screen->DrawTile(2, tridentx, tridenty, TridentTile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, TridentProperties[0]+Link->X, TridentProperties[1]+Link->Y, TridentTile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(trident, TridentProperties, attacker); trident = CreateSword(trident, TridentProperties); } frames++; NoMovementWaitframesAttackerBased(1, attacker); } if(attacker == 0) Link->Invisible = false; // else // G[G_PLAYER_TWO_INVIS] = 0; // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); if(upgrade == 1){ // Screen->DrawTile(2, trident->X, trident->Y, TridentTile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, TridentProperties[0]+Link->X, TridentProperties[1]+Link->Y, TridentTile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(trident, TridentProperties, attacker); trident = CreateSword(trident, TridentProperties); } this->Data = 0; NoMovementWaitframesAttackerBased(1, attacker); for(int i = 0; i <2; i++){ if(attacker == 0){ if(Link->Dir == DIR_UP){ SwordProperties[1] +=4; swordy+=4; } if(Link->Dir == DIR_DOWN){ SwordProperties[1] -=4; swordy-=4; } if(Link->Dir == DIR_LEFT){ SwordProperties[0] +=4; swordx+=4; } if(Link->Dir == DIR_RIGHT){ SwordProperties[0] -=4; swordx-=4; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP) // SwordProperties[1] +=4; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // SwordProperties[1] -=4; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // SwordProperties[0] +=4; // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // SwordProperties[0] -=4; // } // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); if(upgrade == 1){ if(attacker == 0){ if(Link->Dir == DIR_UP){ TridentProperties[1] +=4; tridenty+=4; } if(Link->Dir == DIR_DOWN){ TridentProperties[1] -=4; tridenty-=4; } if(Link->Dir == DIR_LEFT){ TridentProperties[0] +=4; tridentx+=4; } if(Link->Dir == DIR_RIGHT){ TridentProperties[0] -=4; tridentx-=4; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP) // TridentProperties[1] +=4; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // TridentProperties[1] -=4; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // TridentProperties[0] +=4; // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // TridentProperties[0] -=4; // } // Screen->DrawTile(2, tridentx, tridenty, TridentTile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, TridentProperties[0]+Link->X, TridentProperties[1]+Link->Y, TridentTile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(trident, TridentProperties, attacker); trident = CreateSword(trident, TridentProperties); } NoMovementWaitframesAttackerBased(1, attacker); } sword->DeadState = WDS_DEAD; trident->DeadState = WDS_DEAD; } else if(slash == I_TRUE && upgrade == 0){ DrawLinkAttacking(this, false, attacker); NoMovementWaitframesAttackerBased(1, attacker); int swordx; int swordy; if(attacker == 0){ if(Link->Dir == DIR_UP){ // swordx = Link->X+15; // swordy = Link->Y-1; SwordProperties[0] = 15; SwordProperties[1] = -1; } if(Link->Dir == DIR_DOWN){ // swordx = Link->X-13; // swordy = Link->Y+1; SwordProperties[0] = -13; SwordProperties[1] = 1; } if(Link->Dir == DIR_LEFT){ // swordx = Link->X; // swordy = Link->Y-13; SwordProperties[0] = 0; SwordProperties[1] = -13; } if(Link->Dir == DIR_RIGHT){ // swordx = Link->X+3; // swordy = Link->Y-13; SwordProperties[0] = 3; SwordProperties[1] = -13; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // swordx = G[G_PLAYER_TWO_X]+15; // swordy = G[G_PLAYER_TWO_Y]-1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // swordx = G[G_PLAYER_TWO_X]-13; // swordy = G[G_PLAYER_TWO_Y]+1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // swordx = G[G_PLAYER_TWO_X]; // swordy = G[G_PLAYER_TWO_Y]-13; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // swordx = G[G_PLAYER_TWO_X]+3; // swordy = G[G_PLAYER_TWO_Y]-13; // } // } lweapon sword = CreateLWeaponAt(LW_MAGIC, Clamp(swordx, 5, 234), Clamp(swordy, 5, 154)); sword->Step = 0; sword->Dir = Link->Dir; // if(attacker == 1) // sword->Dir = G[G_PLAYER_TWO_DIR]; sword->UseSprite(129); sword->Damage = damage*G[G_WEAPON_MULTIPLIER]; // SwordProperties[0] = swordx-Link->X; // SwordProperties[1] = swordy-Link->Y; // if(attacker == 1){ // SwordProperties[0] = sword->X-G[G_PLAYER_TWO_X]; // SwordProperties[1] = sword->Y-G[G_PLAYER_TWO_Y]; // } Tile = 19881; InitTile = Tile; CSet = 11; SwordProperties[2] = sword->Damage; SwordProperties[3] = Tile; if(attacker == 0){ if(Link->Dir == DIR_DOWN){ SwordProperties[3] +=1; Flip = 1; } if(Link->Dir == DIR_UP){ SwordProperties[3] += 1; } if(Link->Dir ==DIR_LEFT) Flip = 1; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // SwordProperties[3] +=1; // Flip = 1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // SwordProperties[3] += 1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // Flip = 1; // } Tile = SwordProperties[3]; // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); while(frames <5){ // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } DrawLinkAttacking(this, false, attacker); if(attacker == 0){ if(Link->Dir == DIR_UP){ Tile += 1; SwordProperties[0] = 12; SwordProperties[1] = -10; } if(Link->Dir == DIR_DOWN){ Tile += 1; Flip = 3; SwordProperties[0] = -11; SwordProperties[1] = 14; } if(Link->Dir == DIR_LEFT){ Tile += 2; Flip = 1; SwordProperties[0] = -12; SwordProperties[1] = -10; } if(Link->Dir == DIR_RIGHT){ Tile += 2; SwordProperties[0] = 11; SwordProperties[1] = -10; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // Tile += 1; // SwordProperties[0] = 12; // SwordProperties[1] = -10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // Tile += 1; // Flip = 3; // SwordProperties[0] = -11; // SwordProperties[1] = 14; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // Tile += 2; // Flip = 1; // SwordProperties[0] = -12; // SwordProperties[1] = -10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // Tile += 2; // SwordProperties[0] = 11; // SwordProperties[1] = -10; // } // } while(frames <9){ if(frames == 7){ if(Link->InputUp && Link->Dir != DIR_UP){ Tile = InitTile+2; Flip = 0; SwordProperties[0] = 12; SwordProperties[1] = -10; Link->Dir = DIR_UP; sword->Dir = Link->Dir; } else if(Link->InputDown && Link->Dir != DIR_DOWN){ Tile = InitTile+2; Flip = 3; SwordProperties[0] = -11; SwordProperties[1] = 14; Link->Dir = DIR_DOWN; sword->Dir = Link->Dir; } else if(Link->InputLeft && Link->Dir != DIR_LEFT){ Tile = InitTile+2; Flip = 1; SwordProperties[0] = -12; SwordProperties[1] = -10; Link->Dir = DIR_LEFT; sword->Dir = Link->Dir; } else if(Link->InputRight && Link->Dir != DIR_RIGHT){ Tile = InitTile+2; sword->Dir = Link->Dir; Flip = 0; SwordProperties[0] = 11; SwordProperties[1] = -10; Link->Dir = DIR_RIGHT; sword->Dir = Link->Dir; } } Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } if(attacker == 0){ if(Link->Dir == DIR_UP){ Tile -=2; Flip = 0; SwordProperties[0] = 0; SwordProperties[1] = -18; } if(Link->Dir == DIR_DOWN){ Tile -=2; Flip = 3; SwordProperties[0] = 1; SwordProperties[1] = 16; } if(Link->Dir == DIR_LEFT){ Tile -= 1; Flip = 1; SwordProperties[0] = -16; SwordProperties[1] = 2; } if(Link->Dir == DIR_RIGHT){ Tile -= 1; SwordProperties[0] = 16; SwordProperties[1] = 2; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // Tile -=2; // Flip = 0; // SwordProperties[0] = 0; // SwordProperties[1] = -18; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // Tile -=2; // Flip = 3; // SwordProperties[0] = 1; // SwordProperties[1] = 16; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // Tile -= 1; // Flip = 1; // SwordProperties[0] = -16; // SwordProperties[1] = 2; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // Tile -= 1; // SwordProperties[0] = 16; // SwordProperties[1] = 2; // } // } while(frames <12){ if(frames == 11){ if(Link->InputUp && Link->Dir != DIR_UP){ Tile = InitTile; Flip = 0; SwordProperties[0] = 0; SwordProperties[1] = -18; Link->Dir = DIR_UP; sword->Dir = Link->Dir; } else if(Link->InputDown && Link->Dir != DIR_DOWN){ Tile = InitTile; Flip = 2; SwordProperties[0] = 1; SwordProperties[1] = 16; Link->Dir = DIR_DOWN; sword->Dir = Link->Dir; } else if(Link->InputLeft && Link->Dir != DIR_LEFT){ Tile = InitTile+1; Flip = 1; SwordProperties[0] = -16; SwordProperties[1] = 2; Link->Dir = DIR_LEFT; sword->Dir = Link->Dir; } else if(Link->InputRight && Link->Dir != DIR_RIGHT){ Tile = InitTile+1; sword->Dir = Link->Dir; Flip = 0; SwordProperties[0] = 16; SwordProperties[1] = 2; Link->Dir = DIR_RIGHT; sword->Dir = Link->Dir; } } Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); DrawLinkAttacking(this, true, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } //Beams or extra effects like that would go here. DrawLinkAttacking(this, true, attacker); if(attacker == 0){ if(Link->Dir == DIR_UP) SwordProperties[1] +=5; if(Link->Dir == DIR_DOWN) SwordProperties[1] -=5; if(Link->Dir == DIR_LEFT) SwordProperties[0] +=5; if(Link->Dir == DIR_RIGHT) SwordProperties[0] -=5; NoMovementWaitframesAttackerBased(1, attacker); this->Data = 0; Link->Invisible = false; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP) // SwordProperties[1] +=5; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // SwordProperties[1] -=5; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // SwordProperties[0] +=5; // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // SwordProperties[0] -=5; // NoMovementWaitframesAttackerBased(1, attacker); // this->Data = 0; // G[G_PLAYER_TWO_INVIS] = 0; // } sword->DeadState = WDS_DEAD; } else if(slash == I_TRUE && upgrade == 1){ DrawLinkAttacking(this, false, attacker); NoMovementWaitframesAttackerBased(1, attacker); int swordx; int swordy; if(attacker == 0){ if(Link->Dir == DIR_UP){ // swordx = Link->X+15; // swordy = Link->Y-1; SwordProperties[0] = 15; SwordProperties[1] = -1; } if(Link->Dir == DIR_DOWN){ // swordx = Link->X-13; // swordy = Link->Y+1; SwordProperties[0] = -13; SwordProperties[1] = 1; } if(Link->Dir == DIR_LEFT){ // swordx = Link->X; // swordy = Link->Y-13; SwordProperties[0] = 0; SwordProperties[1] = -13; } if(Link->Dir == DIR_RIGHT){ // swordx = Link->X+3; // swordy = Link->Y-13; SwordProperties[0] = 3; SwordProperties[1] = -13; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // swordx = G[G_PLAYER_TWO_X]+15; // swordy = G[G_PLAYER_TWO_Y]-1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // swordx = G[G_PLAYER_TWO_X]-13; // swordy = G[G_PLAYER_TWO_Y]+1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // swordx = G[G_PLAYER_TWO_X]; // swordy = G[G_PLAYER_TWO_Y]-13; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // swordx = G[G_PLAYER_TWO_X]+3; // swordy = G[G_PLAYER_TWO_Y]-13; // } // } lweapon sword = CreateLWeaponAt(LW_MAGIC, Clamp(swordx, 5, 234), Clamp(swordy, 5, 154)); sword->Step = 0; sword->Dir = Link->Dir; // if(attacker == 1) // sword->Dir = G[G_PLAYER_TWO_DIR]; sword->UseSprite(129); sword->Damage = damage*G[G_WEAPON_MULTIPLIER]; // SwordProperties[0] = swordx-Link->X; // SwordProperties[1] = swordy-Link->Y; // if(attacker == 1){ // SwordProperties[0] = sword->X-G[G_PLAYER_TWO_X]; // SwordProperties[1] = sword->Y-G[G_PLAYER_TWO_Y]; // } Tile = 19901; InitTile = Tile; CSet = 1; if(Link->Item[RING_ALIYA]){ Tile = 30701; InitTile = Tile; CSet = 8; } SwordProperties[2] = sword->Damage; SwordProperties[3] = Tile; if(attacker == 0){ if(Link->Dir == DIR_DOWN){ SwordProperties[3] +=1; Flip = 1; } if(Link->Dir == DIR_UP){ SwordProperties[3] += 1; } if(Link->Dir ==DIR_LEFT) Flip = 1; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // SwordProperties[3] +=1; // Flip = 1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // SwordProperties[3] += 1; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // Flip = 1; // } Tile = SwordProperties[3]; UpdateSword(sword, SwordProperties, attacker); while(frames <2){ UpdateSword(sword, SwordProperties, attacker); // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } DrawLinkAttacking(this, false, attacker); if(attacker == 0){ if(Link->Dir == DIR_UP){ Tile += 1; SwordProperties[0] = 12; SwordProperties[1] = -10; } if(Link->Dir == DIR_DOWN){ Tile += 1; Flip = 3; SwordProperties[0] = -11; SwordProperties[1] = 14; } if(Link->Dir == DIR_LEFT){ Tile += 2; Flip = 1; SwordProperties[0] = -12; SwordProperties[1] = -10; } if(Link->Dir == DIR_RIGHT){ Tile += 2; SwordProperties[0] = 11; SwordProperties[1] = -10; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // Tile += 1; // SwordProperties[0] = 12; // SwordProperties[1] = -10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // Tile += 1; // Flip = 3; // SwordProperties[0] = -11; // SwordProperties[1] = 14; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // Tile += 2; // Flip = 1; // SwordProperties[0] = -12; // SwordProperties[1] = -10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // Tile += 2; // SwordProperties[0] = 11; // SwordProperties[1] = -10; // } // } while(frames <5){ Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } if(attacker == 0){ if(Link->Dir == DIR_UP){ Tile -=2; Flip = 0; SwordProperties[0] = 0; SwordProperties[1] = -18; } if(Link->Dir == DIR_DOWN){ Tile -=2; Flip = 3; SwordProperties[0] = 1; SwordProperties[1] = 16; } if(Link->Dir == DIR_LEFT){ Tile -= 1; Flip = 1; SwordProperties[0] = -16; SwordProperties[1] = 2; } if(Link->Dir == DIR_RIGHT){ Tile -= 1; SwordProperties[0] = 16; SwordProperties[1] = 2; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // Tile -=2; // Flip = 0; // SwordProperties[0] = 0; // SwordProperties[1] = -18; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // Tile -=2; // Flip = 3; // SwordProperties[0] = 1; // SwordProperties[1] = 16; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // Tile -= 1; // Flip = 1; // SwordProperties[0] = -16; // SwordProperties[1] = 2; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // Tile -= 1; // SwordProperties[0] = 16; // SwordProperties[1] = 2; // } // } while(frames <7){ Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); DrawLinkAttacking(this, true, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } if(attacker == 0){ if(Link->Dir == DIR_UP){ Tile += 2; Flip = 1; SwordProperties[0] = -12; SwordProperties[1] = -10; } if(Link->Dir == DIR_DOWN){ Tile += 2; Flip = 2; SwordProperties[0] = 11; SwordProperties[1] = 14; } if(Link->Dir == DIR_LEFT){ Tile += 1; Flip = 3; SwordProperties[0] = -12; SwordProperties[1] = 10; } if(Link->Dir == DIR_RIGHT){ Tile += 1; Flip = 2; SwordProperties[0] = 11; SwordProperties[1] = 10; } } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // Tile += 1; // SwordProperties[0] = 12; // SwordProperties[1] = -10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // Tile += 1; // Flip = 3; // SwordProperties[0] = -11; // SwordProperties[1] = 14; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // Tile += 2; // Flip = 1; // SwordProperties[0] = -12; // SwordProperties[1] = -10; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // Tile += 2; // SwordProperties[0] = 11; // SwordProperties[1] = -10; // } // } while(frames <10){ if(frames == 7){ if(Link->InputUp){ Tile = InitTile+2; Flip = 1; SwordProperties[0] = -12; SwordProperties[1] = -10; Link->Dir = DIR_UP; sword->Dir = Link->Dir; } else if(Link->InputDown){ Tile = InitTile+2; Flip = 2; SwordProperties[0] = 11; SwordProperties[1] = 14; Link->Dir = DIR_DOWN; sword->Dir = Link->Dir; } else if(Link->InputLeft){ Tile = InitTile+2; Flip = 3; SwordProperties[0] = -12; SwordProperties[1] = 10; Link->Dir = DIR_LEFT; sword->Dir = Link->Dir; } else if(Link->InputRight){ Tile = InitTile+2; sword->Dir = Link->Dir; Flip = 2; SwordProperties[0] = 11; SwordProperties[1] = 10; Link->Dir = DIR_RIGHT; sword->Dir = Link->Dir; } } Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); UpdateSword(sword, SwordProperties, attacker); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } if(attacker == 0){ if(Link->Dir == DIR_UP){ Tile -= 1; Flip = 1; // swordx = Link->X-15; // swordy = Link->Y-1; SwordProperties[0] = -15; SwordProperties[1] = -1; } if(Link->Dir == DIR_DOWN){ Tile -= 1; Flip = 0; // swordx = Link->X+13; // swordy = Link->Y+1; SwordProperties[0] = 13; SwordProperties[1] = 1; } if(Link->Dir == DIR_LEFT){ Tile -= 2; Flip = 2; // swordx = Link->X; // swordy = Link->Y+13; SwordProperties[0] = 0; SwordProperties[1] = 13; } if(Link->Dir == DIR_RIGHT){ Tile -= 2; Flip = 2; // swordx = Link->X+3; // swordy = Link->Y+13; SwordProperties[0] = 3; SwordProperties[1] = 13; } // SwordProperties[0] = swordx-Link->X; // SwordProperties[1] = swordy-Link->Y; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP){ // Tile -=2; // Flip = 0; // SwordProperties[0] = 0; // SwordProperties[1] = -18; // } // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN){ // Tile -=2; // Flip = 3; // SwordProperties[0] = 1; // SwordProperties[1] = 16; // } // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // Tile -= 1; // Flip = 1; // SwordProperties[0] = -16; // SwordProperties[1] = 2; // } // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT){ // Tile -= 1; // SwordProperties[0] = 16; // SwordProperties[1] = 2; // } // } while(frames <12){ if(frames == 11){ if(Link->InputUp){ Tile = InitTile+1; Flip = 1; SwordProperties[0] = -5; SwordProperties[1] = -1; Link->Dir = DIR_UP; sword->Dir = Link->Dir; } else if(Link->InputDown){ Tile = InitTile+1; Flip = 0; SwordProperties[0] = 13; SwordProperties[1] = 1; Link->Dir = DIR_DOWN; sword->Dir = Link->Dir; } else if(Link->InputLeft){ Tile = InitTile; Flip = 3; SwordProperties[0] = 0; SwordProperties[1] = 13; Link->Dir = DIR_LEFT; sword->Dir = Link->Dir; } else if(Link->InputRight){ Tile = InitTile; Flip = 3; sword->Dir = Link->Dir; SwordProperties[0] = 3; SwordProperties[1] = 13; Link->Dir = DIR_RIGHT; sword->Dir = Link->Dir; } } UpdateSword(sword, SwordProperties, attacker); // Screen->DrawTile(2, swordx, swordy, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); Screen->DrawTile(2, SwordProperties[0]+Link->X, SwordProperties[1]+Link->Y, Tile, 1, 1, CSet, -1, -1, 0, 0, 0, Flip, true, OP_OPAQUE); DrawLinkAttacking(this, false, attacker); UpdateSword(sword, SwordProperties, attacker); sword = CreateSword(sword, SwordProperties); frames++; NoMovementWaitframesAttackerBased(1, attacker); } //Beams or extra effects like that would go here. DrawLinkAttacking(this, false, attacker); if(attacker == 0){ if(Link->Dir == DIR_UP) SwordProperties[1] +=5; if(Link->Dir == DIR_DOWN) SwordProperties[1] -=5; if(Link->Dir == DIR_LEFT) SwordProperties[0] +=5; if(Link->Dir == DIR_RIGHT) SwordProperties[0] -=5; NoMovementWaitframesAttackerBased(1, attacker); this->Data = 0; Link->Invisible = false; } // else{ // if(G[G_PLAYER_TWO_DIR] == DIR_UP) // SwordProperties[1] +=5; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // SwordProperties[1] -=5; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // SwordProperties[0] +=5; // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // SwordProperties[0] -=5; // NoMovementWaitframesAttackerBased(1, attacker); // this->Data = 0; // G[G_PLAYER_TWO_INVIS] = 0; // } sword->DeadState = WDS_DEAD; } } void UpdateSword(lweapon sword, int SwordProperties, int attacker){ sword->DeadState = WDS_ALIVE; if(sword->isValid() && sword->DeadState == WDS_ALIVE){ SwordProperties[2] = sword->Damage; SwordProperties[3] = sword->Tile; SwordProperties[4] = sword->Flip; SwordProperties[5] = sword->CSet; int weaponx = Link->X+SwordProperties[0]; int weapony = Link->Y+SwordProperties[1]; // if(attacker == 1){ // weaponx = G[G_PLAYER_TWO_X]+SwordProperties[0]; // weapony = G[G_PLAYER_TWO_Y]+SwordProperties[1]; // } sword->X = Clamp(weaponx, 5, 234); sword->Y = Clamp(weapony,5,154); sword->DrawXOffset = weaponx-sword->X; sword->DrawYOffset = weapony-sword->Y; sword->HitXOffset = sword->DrawXOffset; sword->HitYOffset = sword->DrawYOffset; sword->Misc[9] = 1; if((Link->Item[RING_RIGGS] && Link->Item[207]) || Link->Item[RING_ALIYA]){ if(G[G_GLOBALFRAMES]%5==0){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, sword->X+Rand(-8, 8), sword->Y+Rand(-8, 8)); l->UseSprite(134); l->DeadState = l->NumFrames*l->ASpeed; } } } } lweapon CreateSword(lweapon sword, int SwordProperties){ if(!sword->isValid() || sword->DeadState == WDS_DEAD){ int weaponx = Link->X+SwordProperties[0]; int weapony = Link->Y+SwordProperties[1]; sword = CreateLWeaponAt(LW_MAGIC, Clamp(weaponx, 5, 234), Clamp(weapony, 5, 154)); sword->DrawXOffset = weaponx-sword->X; sword->DrawYOffset = weapony-sword->Y; sword->HitXOffset = sword->DrawXOffset; sword->HitYOffset = sword->DrawYOffset; sword->Damage = SwordProperties[2]; // sword->Tile = SwordProperties[3]; // sword->Flip = SwordProperties[4]; // sword->CSet = SwordProperties[5]; sword->UseSprite(129); sword->Misc[9] = 1; sword->Step = 0; sword->Dir = Link->Dir; } return sword; } void DrawLinkAttacking(ffc this, bool slashing, int attacker){ if(attacker == 0){ int xposition = Link->X; int yposition = Link->Y; if(slashing){ if(Link->Dir == DIR_UP) yposition -=4; if(Link->Dir == DIR_DOWN) yposition += 4; if(Link->Dir == DIR_LEFT) xposition -= 4; if(Link->Dir == DIR_RIGHT) xposition += 4; } G[G_INVISIBLE] = 1; int attackcombo; if(Link->Item[RING_RIGGS]) attackcombo = 4044+Link->Dir; else if(Link->Item[RING_ALIYA]) attackcombo = 5056+Link->Dir; else attackcombo = 4040+Link->Dir; int layer = 2; int topleft = Screen->ComboF[ComboAt(Link->X, Link->Y)]; int topright = Screen->ComboF[ComboAt(Link->X+15, Link->Y)]; if(topleft == 1 || topleft == 2 || (topleft >= 47 && topleft <= 65) || topright == 1 || topright == 2 || (topright >= 47 && topright <= 65)) //Why can't we just draw to the freaking sprite layer? layer = 3; // for(int i = Screen->NumNPCs(); i >0; i--){ //Any enemies that grab Link, like like-likes, need to go here. // npc n = Screen->LoadNPC(i); // if(n->ID == 53 //smoke cloud // || n->ID == 333 //smoke cloud (easy) // || n->ID == 90 //smoke cloud L2 // || n->ID == 290 //smoke cloud L3 // || n->ID == 200 //Jellyfish // || n->ID == 329 //Jellyfish (Easy) // || n->ID == 283 //Jellyfish L2 // ){ // if(Distance(Link->X, Link->Y, n->X, n->Y) <=4) // layer = 1; // } // } Screen->FastCombo(layer, xposition, yposition, attackcombo, 6, OP_OPAQUE); // if(Screen->ComboT[ComboAt(Link->X, Link->Y+15)] == CT_SHALLOWWATER && Screen->ComboT[ComboAt(Link->X+15, Link->Y+15)] == CT_SHALLOWWATER) // Screen->FastCombo(layer, Link->X, Link->Y, 3724, 6, OP_OPAQUE); // if(Screen->ComboT[ComboAt(Link->X, Link->Y+15)] == CT_TALLGRASS && Screen->ComboT[ComboAt(Link->X+15, Link->Y+15)] == CT_TALLGRASS) // Screen->FastCombo(layer, Link->X, Link->Y, 3725, 9, OP_OPAQUE); } // else{ // int xposition = G[G_PLAYER_TWO_X]; // int yposition = G[G_PLAYER_TWO_Y]; // if(slashing){ // if(G[G_PLAYER_TWO_DIR] == DIR_UP) // yposition -=4; // if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // yposition += 4; // if(G[G_PLAYER_TWO_DIR] == DIR_LEFT) // xposition -= 4; // if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // xposition += 4; // } // G[G_PLAYER_TWO_INVIS] = 1; // int attackcombo; // int CurrentChar = G[G_PLAYER_TWO_CHARACTER]; // int flip; // if(G[G_PLAYER_TWO_DIR] == DIR_UP) // attackcombo = PlayerTwoTile[CurrentChar] +11; // else if(G[G_PLAYER_TWO_DIR] == DIR_DOWN) // attackcombo = PlayerTwoTile[CurrentChar] +7; // else if(G[G_PLAYER_TWO_DIR] == DIR_LEFT){ // attackcombo = PlayerTwoTile[CurrentChar] +6; // flip = 1; // } // else if(G[G_PLAYER_TWO_DIR] == DIR_RIGHT) // attackcombo = PlayerTwoTile[CurrentChar] +6; // int layer = 3; // for(int i = Screen->NumNPCs(); i >0; i--){ // npc n = Screen->LoadNPC(i); // if(n->ID == 53 //smoke cloud // || n->ID == 333 //smoke cloud (easy) // || n->ID == 90 //smoke cloud L2 // || n->ID == 290 //smoke cloud L3 // || n->ID == 200 //Jellyfish // || n->ID == 329 //Jellyfish (Easy) // || n->ID == 283 //Jellyfish L2 // ){ // if(Distance(G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y], n->X, n->Y) <=4) // layer = 1; // } // } // Screen->DrawTile(2, xposition, yposition, attackcombo, 1, 1, PlayerTwoCSet[CurrentChar], -1, -1, 0, 0, 0, flip, true, OP_OPAQUE); // if(Screen->ComboT[ComboAt(G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y]+15)] == CT_SHALLOWWATER && Screen->ComboT[ComboAt(G[G_PLAYER_TWO_X]+15, G[G_PLAYER_TWO_Y]+15)] == CT_SHALLOWWATER) // Screen->FastCombo(layer, G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y], 3724, 6, OP_OPAQUE); // if(Screen->ComboT[ComboAt(G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y]+15)] == CT_TALLGRASS && Screen->ComboT[ComboAt(G[G_PLAYER_TWO_X]+15, G[G_PLAYER_TWO_Y]+15)] == CT_TALLGRASS) // Screen->FastCombo(layer, G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y], 3725, 9, OP_OPAQUE); // } } } void NoMovementWaitframesAttackerBased(int frames, int attacker){ for(int i = frames; i >0; i--){ if(attacker == 0){ Link->InputUp = false; Link->PressUp = false; Link->InputDown = false; Link->PressDown = false; Link->InputLeft = false; Link->PressLeft = false; Link->InputRight = false; Link->PressRight = false; Waitframe(); if(frames == 1){ if(Link->InputUp) Link->PressUp = true; if(Link->InputDown) Link->PressDown = true; if(Link->InputLeft) Link->PressLeft = true; if(Link->InputRight) Link->PressRight = true; } } // else{ // Link->InputEx1 = false; // Link->PressEx1 = false; // Link->InputEx2 = false; // Link->PressEx2 = false; // Link->InputEx3 = false; // Link->PressEx3 = false; // Link->InputEx4 = false; // Link->PressEx4 = false; // Waitframe(); // if(frames == 1){ // if(Link->InputEx1) // Link->PressEx1 = true; // if(Link->InputEx2) // Link->PressEx2 = true; // if(Link->InputEx3) // Link->PressEx3 = true; // if(Link->InputEx4) // Link->PressEx4 = true; // } // } } } int CountFFCsRunningAttacker(int scriptNum, int attacker) { // Invalid script if(scriptNum<0 || scriptNum>511) return 0; ffc f; int numFFCs=0; for(int i=1; i<=32; i++) { f=Screen->LoadFFC(i); if(f->Script==scriptNum && f->Misc[0] == attacker) numFFCs++; } return numFFCs; } int RunFFCScriptAttacker(int scriptNum, float args, int attacker) { // Invalid script if(scriptNum<0 || scriptNum>511) return 0; ffc theFFC; // Find an FFC not already in use for(int i=FFCS_MIN_FFC; i<=FFCS_MAX_FFC; i++) { theFFC=Screen->LoadFFC(i); if(theFFC->Script!=0 || (theFFC->Data!=0 && theFFC->Data!=FFCS_INVISIBLE_COMBO) || (scriptNum == 343 && theFFC->Flags[FFCF_CHANGER] == true)) continue; // Found an unused one; set it up theFFC->Data=FFCS_INVISIBLE_COMBO; theFFC->Script=scriptNum; theFFC->Misc[0] = attacker; theFFC->Link = GetFFCNumber(theFFC); theFFC->Vx = 0; theFFC->Vy = 0; if(args!=NULL) { for(int j=Min(SizeOfArray(args), 8)-1; j>=0; j--) theFFC->InitD[j]=args[j]; } return i; } // No FFCs available return 0; } int GetFFCNumber(ffc testffc){ for(int i = 1; i <= 32; i++){ ffc f = Screen->LoadFFC(i); if(f == testffc) return i; } } ffc script SecretToggle{ void run(int light){ int orig = this->Data; while(true){ for(int i = Screen->NumLWeapons(); i>0; i--){ lweapon l = Screen->LoadLWeapon(i); if(Collision(l, this)){ Screen->TriggerSecrets(); this->Data = light; Game->PlaySound(27); Waitframes(60); this->Data = orig; break; } } Waitframe(); } } } //These arrays store the position of any underwater screen you get an item/activate a secret on while underwater, so they can be reset if you die. int DMapArray[1000]; int ScreenArray[1000]; //This one stores items you've collected underwater. The G vars G_TEMPHEARTCONTAINERS, G_TEMPOFFENSEUP, and G_TEMPDEFENSEUP store the number of upgrades picked up int TempItems[50]; void ClearResetArrays(){ for(int i = 0; i<1000; i++){ if(DMapArray[i] == 0) break; DMapArray[i] = 0; ScreenArray[i] = 0; TempItems[i] = 0; G[G_TEMPHEARTCONTAINERS] = 0; G[G_TEMPOFFENSEUP] = 0; G[G_TEMPDEFENSEUP] = 0; G[G_TEMPALLOY] = 0; G[G_TEMPLETTER1] = 0; G[G_TEMPLETTER2] = 0; } } ffc script WriteToResetArrays{ void run(){ bool secret = Screen->State[ST_SECRET]; bool tem = Screen->State[ST_ITEM]; bool spe = Screen->State[ST_SPECIALITEM]; bool chest = Screen->State[ST_CHEST]; while(secret == Screen->State[ST_SECRET] && tem == Screen->State[ST_ITEM] && spe == Screen->State[ST_SPECIALITEM] && chest == Screen->State[ST_CHEST]) Waitframes(10); int i; for(i = 0; i<1000; i++){ if(DMapArray[i] == 0) break; } DMapArray[i] = Game->GetCurDMap(); ScreenArray[i] = Game->GetCurScreen(); } } void Reset(){ for(int i = 0; i<1000; i++){ if(DMapArray[i] == 0) break; Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_SECRET, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_ITEM, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_SPECIALITEM, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_CHEST, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_BOSSCHEST, false); if(DMapArray[i] == 5){ //All dungeons go here, we gotta reset them wholesale Game->LKeys[Game->DMapLevel[DMapArray[i]]] = 0; Game->LItems[Game->DMapLevel[DMapArray[i]]] = 0; for(int j = 0; j<128; j++){ Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_SECRET, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_ITEM, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_SPECIALITEM, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_DOORUP, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_DOORDOWN, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_DOORLEFT, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], j, ST_DOORRIGHT, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_CHEST, false); Game->SetScreenState(Game->DMapMap[DMapArray[i]], ScreenArray[i], ST_BOSSCHEST, false); } } } for(int i = 0; i<50; i++){ if(TempItems[i] == 0) break; Link->Item[TempItems[i]] = false; } Link->MaxHP -= 8*G[G_TEMPHEARTCONTAINERS]; G[G_NUMOFFENSE] -= G[G_TEMPOFFENSEUP]; G[G_NUMDEFENSE] -= G[G_TEMPDEFENSEUP]; G[G_NUMALLOY] -= G[G_TEMPALLOY]; if(G[G_TEMPLETTER1] != 0){ G[G_TEMPLETTER1] = 0; G[G_LETTER1] = 0; } if(G[G_TEMPLETTER2] != 0){ G[G_TEMPLETTER2] = 0; G[G_LETTER2] = 0; } } item script TempPickup{ //The Temp stuff is all unused. I just started piling crap onto this cuz yay void run(int which){ if(which != 29 && which != 30 && which != 210 && which != 84){ G[G_AREAITEMSSTART + G[G_SUBSCREENAREA]] += 1; } if(which == 0){ //Heart Container // G[G_TEMPHEARTCONTAINERS] += 8; G[G_HPDRAIN] = 0; G[G_HPDRAINPENALTY] = 0; if(G[G_MESSAGEHEART] == 0){ G[G_MESSAGEHEART] = 1; ItemPopup(21115, 8, 44); } else{ int PickupMessage[] = "Heart Container"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } } else if(which == 1){ //Offense // G[G_TEMPOFFENSEUP] ++; G[G_NUMOFFENSE] ++; if(G[G_MESSAGEOFFENSE] == 0){ G[G_MESSAGEOFFENSE] = 1; ItemPopup(20881, 8, 42); } else{ int PickupMessage[] = "Offense Ring"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } } else if(which == 2){ //Defense // G[G_TEMPDEFENSEUP] ++; G[G_NUMDEFENSE] ++; if(G[G_MESSAGEDEFENSE] == 0){ G[G_MESSAGEDEFENSE] = 1; ItemPopup(20862, 8, 43); } else{ int PickupMessage[] = "Defense Ring"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } } else if(which == 3){ //Magical Alloy G[G_NUMALLOY] ++; // G[G_TEMPALLOY] ++; if(G[G_MESSAGEALLOY] == 0){ G[G_MESSAGEALLOY] = 1; ItemPopup(23431, 7, 45); } else{ int PickupMessage[] = "Magical Alloy"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } } else if(which == 4 || which == 5){ G[G_LETTER1 + which-4] ++; // G[G_TEMPLETTER1 + which-4] ++; ItemPopup(23440, 7, 56); } else if(which == 6){ G[G_NUMTEARS]++; } else if(which == 177){ ItemIDs[2] = 177; ItemCSets[2] = 8; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 3) G[i] = 177; } } else if(which == 220){ ItemIDs[4] = 220; ItemTiles[4] = 22124; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 11) G[i] = 220; } } if(which == 30){ ItemIDs[9] = 30; ItemTiles[9] = 21226; ItemCSets[9] = 8; Link->Item[29] = false; } if(which == 29){ ItemIDs[9] = 29; ItemTiles[9] = 22327; ItemCSets[9] = 7; Link->Item[30] = false; } // else{ // int i; // for(i = 0; i<50; i++){ // if(TempItems[i] == 0) // break; // } // TempItems[i] = which; // } if(which == 68){ //Long bow if(Link->Item[221]) ItemTiles[3] = 21898; else ItemTiles[3] = 21916; } if(which == 221){ ItemIDs[3] = 221; if(Link->Item[68]) ItemTiles[3] = 21898; else ItemTiles[3] = 21897; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 13) G[i] = 221; } } if(which == 84){ //KEY if(G[G_MESSAGEKEY] == 0){ G[G_MESSAGEKEY] = 1; ItemPopup(23120, 11, 41); } else{ int PickupMessage[] = "Key"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } } if(which == 219){ //Tower key for(int i = G_TABLETSTART; i<=G_TABLETSTART+5; i++){ if(G[i] == 0){ G[i] = 1; break; } } int PickupMessage[] = "Tower Key"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } if(which == 82){ //Bomb bag int PickupMessage[] = "Bomb Bag"; strcpy(PickupString, PickupMessage); G[G_ITEMPOPUP_LENGTH] = CountStringLength(PickupString); G[G_ITEMPOPUP] = 256; G[G_ITEMPOPUPTYPE] = 0; } if(which == 23){ //Boomerang ItemPopup(21347, 8, 46); } if(which == 19){ //Bracelet ItemPopup(23025, 8, 47); } if(which == 13){ //Arrows ItemPopup(21895, 8, 48); } if(which == 11){ //Candle ItemPopup(22120, 8, 49); } if(which == 27){ //Ladder ItemPopup(22942, 8, 50); } if(which == 25){ //Wand ItemPopup(22420, 7, 51); } if(which == 213){ //Ice Tome ItemPopup(22428, 7, 52); } if(which == 32){ //Lightning Tome ItemPopup(22428, 8, 53); } if(which == 52){ //Hookshot ItemPopup(22560, 7, 54); } if(which == 211){ //Broken Trident ItemPopup(19760, 7, 58); } if(which == 205){ //Trident ItemPopup(19780, 7, 60); } if(which == 212){ //Broken Chains ItemPopup(19920, 1, 59); } if(which == 207){ //Chains ItemPopup(19900, 1, 61); } if(which == 174){ //Compass ItemPopup(23420, 8, 55); } if(which == 177){ //Remote Bombs ItemPopup(21783, 8, 57); } if(which == 68){ //Long Bow ItemPopup(21934, 7, 63); } if(which == 186){ //Monster Mirror ItemPopup(52098, 1, 64); } if(which == 210){ //Tablet Map ItemPopup(23440, 8, 65); } if(which == 8){ //Tablet Map ItemPopup(20325, 8, 66); } if(which == 220){ //Lantern ItemPopup(22124, 8, 68); } if(which == 221){ //Tri arrows ItemPopup(21891, 7, 69); } if(which == 41){ //Wallet ItemPopup(23042, 8, 70); } } } ffc script ContinuePoint{ void run(int type){ if(type == 0){ //Continue here if(Game->GetCurLevel() != Game->DMapLevel[Game->ContinueDMap] || Game->GetCurDMap() != Game->ContinueDMap){ Game->ContinueDMap = Game->GetCurDMap(); Game->LastEntranceDMap = Game->GetCurDMap(); Game->ContinueScreen = Game->GetCurDMapScreen(); Game->LastEntranceScreen = Game->GetCurDMapScreen(); } } else if(type == 1){ //Continue underwater Game->ContinueDMap = 0; Game->LastEntranceDMap = 0; Game->ContinueScreen = 0x77; Game->LastEntranceScreen = 0x77; } else if(type == 2 && !(G[G_TOWNATTACKONEEXTRO] == 0 && G[G_NUMTEARS] >= 2)){ //Continue above water Game->ContinueDMap = 9; Game->LastEntranceDMap = 9; Game->ContinueScreen = 0x78; Game->LastEntranceScreen = 0x78; } else if(type == 4){ //Tower exception Game->ContinueDMap = 29; Game->LastEntranceDMap = 29; Game->ContinueScreen = 0x71; Game->LastEntranceScreen = 0x71; } else if(type == 3){ //Tower exception Game->ContinueDMap = 33; Game->LastEntranceDMap = 33; Game->ContinueScreen = 0x7D; Game->LastEntranceScreen = 0x7D; } else if(type == 5){ //Tower exception Game->ContinueDMap = 30; Game->LastEntranceDMap = 30; Game->ContinueScreen = 0x75; Game->LastEntranceScreen = 0x75; } else if(type == 6){ //Tower exception Game->ContinueDMap = 31; Game->LastEntranceDMap = 31; Game->ContinueScreen = 0x68; Game->LastEntranceScreen = 0x68; } else if(type == 7){ //Tower exception Game->ContinueDMap = 32; Game->LastEntranceDMap = 32; Game->ContinueScreen = 0x7B; Game->LastEntranceScreen = 0x7B; } else if(type == 8){ //Tower exception Game->ContinueDMap = 34; Game->LastEntranceDMap = 34; Game->ContinueScreen = 0x60; Game->LastEntranceScreen = 0x60; } else if(type == 9){ //Tower exception Game->ContinueDMap = 35; Game->LastEntranceDMap = 35; Game->ContinueScreen = 0x73; Game->LastEntranceScreen = 0x73; } else if(type == 10){ //Tower exception Game->ContinueDMap = 36; Game->LastEntranceDMap = 36; Game->ContinueScreen = 0x66; Game->LastEntranceScreen = 0x66; } else if(type == 11){ //L3 exception Game->ContinueDMap = 7; Game->LastEntranceDMap = 7; Game->ContinueScreen = 0x73; Game->LastEntranceScreen = 0x73; } // ClearResetArrays(); } } ffc script PitFish{ void run(int enemyID){ int pitcombo = 1; if(Game->GetCurDMap() == 2) pitcombo = 3613; int numpits; for(int i = 0; i <176; i++){ if(Screen->ComboD[i] == pitcombo){ numpits++; } } npc ghost = Ghost_InitAutoGhost(this, enemyID); int originaldata = Ghost_Data; Ghost_Data = 1; ghost->Misc[5] = 1; Ghost_Waitframes(this, ghost, true, true,8); ghost->Misc[5] = 0; //Ghost_Data = originaldata; Ghost_SetFlag(GHF_FLYING_ENEMY); //Ghost_SetFlag(GHF_8WAY); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_IGNORE_SOLIDITY); //Ghost_SetFlag(GHF_SET_DIRECTION); Ghost_UnsetFlag(GHF_KNOCKBACK); ghost->CollDetection = false; int loc; int OriginalHP = Ghost_HP; int walkcounter = -1; int walktarget; // int targettimer = Rand(180, 240); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // walktarget = Rand(0,1); // } if(numpits == 0) Ghost_HP = 0; while(true){ Ghost_Waitframes(this, ghost, true, true, Rand(60,180)); //Come out of the pit do{ loc = Rand(0, 175); } while(Screen->ComboD[loc] != pitcombo); Ghost_X = ComboX(loc); Ghost_Y = ComboY(loc); for(int i = 540; i<=542; i++){ for(int j = 0; j<=10; j++){ Screen->FastTile(1, ComboX(loc), ComboY(loc), i, Ghost_CSet, OP_OPAQUE); Ghost_Waitframe(this, ghost, true, true); } } Ghost_Data = originaldata; ghost->CollDetection = true; Ghost_SetFlag(GHF_8WAY); Ghost_SetFlag(GHF_SET_DIRECTION); //Move around (Give enemy a high homing value for it to be effective for(int i = 0; i<=300; i++){ // Ghost_2PlayerVariableWalk8(walkcounter, ghost->Step, ghost->Rate, ghost->Homing , ghost->Hunger, 8, walktarget); Ghost_VariableWalk8(walkcounter, ghost->Step, ghost->Rate, ghost->Homing , ghost->Hunger, 8); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // targettimer--; // if(targettimer == 0){ // if(Rand(0,1) == 1) // walktarget = Rand(0,1); // targettimer = Rand(180, 240); // } // } Ghost_Waitframe(this, ghost, true, true); } //Go back into the pit do{ loc = Rand(0, 175); } while(Screen->ComboD[loc] != pitcombo); while(Distance(Ghost_X, Ghost_Y, ComboX(loc), ComboY(loc)) > 4){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, ComboX(loc), ComboY(loc)), ghost->Step/100, 0); Ghost_Waitframe(this, ghost, true, true); } Ghost_UnsetFlag(GHF_8WAY); Ghost_UnsetFlag(GHF_SET_DIRECTION); Ghost_Data = 1; ghost->CollDetection = false; for(int i = 563; i>=561; i--){ for(int j = 0; j<=10; j++){ Screen->FastTile(1, ComboX(loc), ComboY(loc), i, Ghost_CSet, OP_OPAQUE); Ghost_Waitframe(this, ghost, true, true); } } Ghost_HP +=200; if(Ghost_HP > OriginalHP) Ghost_HP = OriginalHP; Ghost_Waitframe(this, ghost, true, true); } } } ffc script Gargoyle{ void run(int distance, int type, int solidcombo, int secrettype, int itemargument){ int originalcombo = Screen->ComboD[ComboAt(this->X, this->Y)]; Screen->ComboD[ComboAt(this->X, this->Y)] = solidcombo; int originalx = this->X; int originaly = this->Y; int originalcset = this->CSet; int maxcounter = 20; int chargecounter = maxcounter; // int chargetarget; int standcombo = this->Data; int walkcombo = this->Data+1; while(true){ if(type == 0){ if(Distance(Link->X+8, Link->Y+8, this->X+8, this->Y+8) < distance){ npc ghost = Ghost_InitCreate(this, 271); ghost->X = this->X; ghost->Y = this->Y + 2; Ghost_X = ghost->X; Ghost_Y = ghost->Y; Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_REDUCED_KNOCKBACK); Ghost_Transform(this, ghost, 4080, 7, 1, 1); ghost->DrawYOffset = 0; // if(G[G_DIFFICULTY] == DIF_HARD || G[G_DIFFICULTY] == DIF_VHARD){ // Ghost_HP += 20; // ghost->Damage += 1; // ghost->WeaponDamage += 1; // } // if(G[G_DIFFICULTY] == DIF_EASY){ // Ghost_HP -= 20; // ghost->Damage -= 1; // ghost->WeaponDamage -= 1; // } ghost->CollDetection = false; int step = ghost->Step; if(Rand(0,1) == 1){ step = 150; Ghost_CSet = 8; } int counter = -1; // int targetcounter = Rand(180,240); // int walktarget; int timer = 30; int itemflag; while(true){ if(timer > 0){ ghost->Stun = 0; Ghost_X = originalx; Ghost_Y = originaly; timer--; if(timer == 0){ Screen->ComboD[ComboAt(GridX(this->X+8), GridY(this->Y+8))] = originalcombo; ghost->CollDetection = true; } } else{ if(itemflag == 0){ itemflag = 1; if(secrettype == 1 && NumItemsOf(itemargument) == 0 && !Screen->State[ST_ITEM]){ Game->PlaySound(27); item tem = CreateItemAt(itemargument, this->X, this->Y); tem->Pickup = IP_ST_ITEM; } } counter = Ghost_ConstantWalk4(counter,step,ghost->Rate,ghost->Homing,0); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // targetcounter--; // if(targetcounter == 0){ // if(Rand(0,1) == 1) // walktarget = Rand(0,1); // targetcounter = Rand(180,240); // } // } } Ghost_Waitframe(this, ghost, true, true); } } } else if(type == 1 || type == 2){ int oldchargecounter = chargecounter; if(chargecounter >0){ if(Distance(Link->X+8, Link->Y+8, this->X+8, this->Y+8) < distance && this->CSet == originalcset){ if((Link->X >= this->X && Link->X <= this->X+15) || (Link->X+15 >= this->X && Link->X+15 <= this->X+15) || (Link->Y >= this->Y && Link->Y <= this->Y+15) || (Link->Y+15 >= this->Y && Link->Y+15 <= this->Y+15)){ // chargetarget = 0; this->Data = walkcombo; chargecounter--; } } // if(Distance(G[G_PLAYER_TWO_X]+8, G[G_PLAYER_TWO_Y]+8, this->X+8, this->Y+8) < distance && G[G_MULTIPLAYER_ENABLED] == 1 && chargecounter == oldchargecounter){ // if((G[G_PLAYER_TWO_X] >= this->X && G[G_PLAYER_TWO_X] <= this->X+15) || (G[G_PLAYER_TWO_X]+15 >= this->X && G[G_PLAYER_TWO_X]+15 <= this->X+15)|| (G[G_PLAYER_TWO_Y] >= this->Y && G[G_PLAYER_TWO_Y] <= this->Y+15) || (G[G_PLAYER_TWO_Y]+15 >= this->Y && G[G_PLAYER_TWO_Y]+15 <= this->Y+15)){ // chargetarget = 1; // this->Data = 5426; // chargecounter--; // } // } int ChargeDir; // if(chargetarget == 0) ChargeDir = AngleDir4(Angle(this->X+8, this->Y+8, Link->X+8, Link->Y+8)); // else // ChargeDir = AngleDir4(Angle(this->X+8, this->Y+8, G[G_PLAYER_TWO_X]+8, G[G_PLAYER_TWO_Y]+8)); if(oldchargecounter == chargecounter || !CanWalk(this->X, this->Y, ChargeDir, 1, true)){ chargecounter = maxcounter; this->Data = standcombo; } if(this->Data == standcombo){ //Freezing and unfreezing for(int i = Screen->NumLWeapons(); i>0; i--){ lweapon l = Screen->LoadLWeapon(i); if(this->CSet == originalcset){ if(l->ID == LW_REFROCK){ if(Collision(l, this)){ this->CSet = 7; Game->PlaySound(44); } } } else{ if(l->ID == LW_FIRE || l->ID == LW_BEAM){ if(Collision(l, this)){ this->CSet = originalcset; lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+Rand(-8, 8), this->Y+Rand(-8, 8)); l2->UseSprite(115); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; Game->PlaySound(66); } } } } } } else if(chargecounter <= 0){ //This is the block that makes it walk // this->CSet = 11; int damage = 3; bool flag = false; int ChargeDir; // if(chargetarget == 0) ChargeDir = AngleDir4(Angle(this->X+8, this->Y+8, Link->X+8, Link->Y+8)); // else // ChargeDir = AngleDir4(Angle(this->X+8, this->Y+8, G[G_PLAYER_TWO_X]+8, G[G_PLAYER_TWO_Y]+8)); this->Data = walkcombo; Screen->ComboD[ComboAt(GridX(this->X+8), GridY(this->Y+8))] = originalcombo; Waitframe(); bool NoCharge; if(ChargeDir == 1 && Screen->ComboF[ComboAt(this->X, this->Y+16)] == 67) NoCharge = true; if(!NoCharge){ if(ChargeDir == 0) this->Vy = -1; else if(ChargeDir == 1) this->Vy = 1; else if(ChargeDir == 2) this->Vx = -1; else if(ChargeDir == 3) this->Vx = 1; while(true){ if(this->X == GridX(this->X) && this->Y == GridY(this->Y)){ for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if(f->Data == 1236 && this->X == f->X && this->Y == f->Y){ ChargeDir = 0; this->Vy = -1; this->Vx = 0; } if(f->Data == 1237 && this->X == f->X && this->Y == f->Y){ ChargeDir = 1; this->Vy = 1; this->Vx = 0; } if(f->Data == 1238 && this->X == f->X && this->Y == f->Y){ ChargeDir = 2; this->Vy = 0; this->Vx = -1; } if(f->Data == 1239 && this->X == f->X && this->Y == f->Y){ ChargeDir = 3; this->Vy = 0; this->Vx = 1; } } int TheCombo = Screen->ComboD[ComboAt(this->X, this->Y)]; if(TheCombo == 1240){ ChargeDir = 0; this->Vy = -1; this->Vx = 0; } if(TheCombo == 1241){ ChargeDir = 1; this->Vy = 1; this->Vx = 0; } if(TheCombo == 1242){ ChargeDir = 2; this->Vy = 0; this->Vx = -1; } if(TheCombo == 1243){ ChargeDir = 3; this->Vy = 0; this->Vx = 1; } } while(this->Misc[0] == 10){ this->Vx = 0; this->Vy = 0; Waitframe(); } if(this->Misc[0] > 0 && this->Misc[0] != 10){ ChargeDir = this->Misc[0] - 1; this->Misc[0] = 0; } if(ChargeDir == 0) this->Vy = -1; else if(ChargeDir == 1) this->Vy = 1; else if(ChargeDir == 2) this->Vx = -1; else if(ChargeDir == 3) this->Vx = 1; this->Flags[FFCF_STATIONARY] = false; // if(RectCollision(Link->X+2, Link->Y+2, Link->X+14, Link->Y+14, this->X+2, this->Y+2, this->X+14, this->Y+14)) if(type == 1){ if(RectCollision(Link->X+4, Link->Y+4, Link->X+12, Link->Y+12, this->X+4, this->Y+4, this->X+12, this->Y+12)) DamageLink(damage); } if(type == 2){ if(RectCollision(Link->X+4, Link->Y+4, Link->X+12, Link->Y+12, this->X+4, this->Y+4, this->X+12, this->Y+12)){ FireEWeapon(EW_BOMBBLAST, this->X, this->Y, 0, 0, damage, -1, -1, 0); this->Data = 0; Quit(); } npc n = Screen->LoadNPC(1); if(RectCollision(n->X+4, n->Y+4, n->X+12, n->Y+12, this->X+4, this->Y+4, this->X+12, this->Y+12)){ FireEWeapon(EW_BOMBBLAST, this->X, this->Y, 0, 0, damage, -1, -1, 0); this->Data = 0; Quit(); } } // if(G[G_MULTIPLAYER_ENABLED] == 1 && RectCollision(G[G_PLAYER_TWO_X]+2, G[G_PLAYER_TWO_Y]+2, G[G_PLAYER_TWO_X]+14, G[G_PLAYER_TWO_Y]+14, this->X+2, this->Y+2, this->X+14, this->Y+14)) // DamageP2(damage); if(!ArmosCanWalk(this->X, this->Y, ChargeDir, 1, true) && this->Misc[0] != 10){ bool flag; for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if((f->Script == 9 || f->Script == 12) && Collision(this, f)) flag == true; } int TheCombo = Screen->ComboD[ComboAt(this->X, this->Y)]; if(TheCombo >= 1240 && TheCombo <=1243) flag = true; if(flag){ } else break; } Waitframe(); } } this->Vx = 0; this->Vy = 0; this->X = GridX(this->X); this->Y = GridX(this->Y); originalcombo = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; Waitframe(); if(originalcombo == 4081){ //Switch Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = 4082; for(int i = 0; i < 176; i++){ if(Screen->ComboD[i] == 4081) flag = true; } if(!flag){ //All switches covered up if(secrettype == 0){ if(!Screen->State[ST_ITEM] && NumItemsOf(84) == 0){ Game->PlaySound(27); for(int i = 0; i < 176; i++){ if(Screen->ComboD[i] == 517){ item tem = CreateItemAt(84, ComboX(i), ComboY(i)); tem->Pickup = IP_ST_ITEM; } } } } else if(secrettype == 1){ Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; } else if(secrettype == 2){ Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; if(!Screen->State[ST_ITEM] && NumItemsOf(84) == 0){ Game->PlaySound(27); for(int i = 0; i < 176; i++){ if(Screen->ComboD[i] == 517){ item tem = CreateItemAt(84, ComboX(i), ComboY(i)); tem->Pickup = IP_ST_ITEM; } } } } } else flag = false; } else Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = solidcombo; chargecounter = maxcounter; Waitframes(30); this->Data = standcombo; } } Waitframe(); } } } //This script is more comment than code //Someone take away my ZScript license please ffc script ArmosEnemy{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this, enemyID); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_REDUCED_KNOCKBACK); Ghost_Transform(this, ghost, 4080, 7, 1, 1); ghost->DrawYOffset = 0; // if(G[G_DIFFICULTY] == DIF_HARD || G[G_DIFFICULTY] == DIF_VHARD){ // Ghost_HP += 20; // ghost->Damage += 1; // ghost->WeaponDamage += 1; // } // if(G[G_DIFFICULTY] == DIF_EASY){ // Ghost_HP -= 20; // ghost->Damage -= 1; // ghost->WeaponDamage -= 1; // } // ghost->CollDetection = false; int step = ghost->Step; if(Rand(0,1) == 1){ step = 150; Ghost_CSet = 8; } int counter = -1; // int targetcounter = Rand(180,240); // int walktarget; int timer = 30; while(true){ // if(timer > 0){ // ghost->Stun = 0; // Ghost_X = originalx; // Ghost_Y = originaly; // timer--; // if(timer == 0){ // Screen->ComboD[ComboAt(GridX(this->X+8), GridY(this->Y+8))] = originalcombo; // ghost->CollDetection = true; // } // } // else{ counter = Ghost_ConstantWalk4(counter,step,ghost->Rate,ghost->Homing,0); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // targetcounter--; // if(targetcounter == 0){ // if(Rand(0,1) == 1) // walktarget = Rand(0,1); // targetcounter = Rand(180,240); // } // } // } Ghost_Waitframe(this, ghost, true, true); } } } ffc script SlidingTile{ void run(){ int PastCombo = 0; while(true){ if(RectCollision(this->X, this->Y, this->X+15, this->Y+15, Link->X+8, Link->Y+8, Link->X+8, Link->Y+8)){ if(PastCombo == ComboAt(this->X, this->Y) - 1){ for(int i = 0; i<16; i++){ if(i%4 == 0) Game->PlaySound(1); this->X--; Waitframe(); } } if(PastCombo == ComboAt(this->X, this->Y) + 1){ for(int i = 0; i<16; i++){ if(i%4 == 0) Game->PlaySound(1); this->X++; Waitframe(); } } if(PastCombo == ComboAt(this->X, this->Y) - 16){ for(int i = 0; i<16; i++){ if(i%4 == 0) Game->PlaySound(1); this->Y--; Waitframe(); } } if(PastCombo == ComboAt(this->X, this->Y) + 16){ for(int i = 0; i<16; i++){ if(i%4 == 0) Game->PlaySound(1); this->Y++; Waitframe(); } } } PastCombo = ComboAt(Link->X+8, Link->Y+8); if(Screen->ComboF[PastCombo] == 67 || Screen->ComboF[PastCombo] == 103) PastCombo = 0; for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if((f->Script == 12 || f->Script == 11 || f->Script == 9) && f->X == ComboX(PastCombo) && f->Y == ComboY(PastCombo)){ PastCombo = 0; break; } } Waitframe(); } } } bool ArmosCanWalk(int x, int y, int dir, int step, bool full_tile) { int c=8; int xx = x+15; int yy = y+15; if(full_tile) c=0; if(dir==0) return !(y-step<0||Screen->isSolid(x,y+c-step)||Screen->isSolid(x+8,y+c-step)||Screen->isSolid(xx,y+c-step)||Screen->ComboF[ComboAt(x,y+c-step)] == 67); else if(dir==1) return !(yy+step>=176||Screen->isSolid(x,yy+step)||Screen->isSolid(x+8,yy+step)||Screen->isSolid(xx,yy+step)||Screen->ComboF[ComboAt(x,yy-step)] == 67); else if(dir==2) return !(x-step<0||Screen->isSolid(x-step,y+c)||Screen->isSolid(x-step,y+c+7)||Screen->isSolid(x-step,yy)||Screen->ComboF[ComboAt(x-step,y+c)] == 67); else if(dir==3) return !(xx+step>=256||Screen->isSolid(xx+step,y+c)||Screen->isSolid(xx+step,y+c+7)||Screen->isSolid(xx+step,yy)||Screen->ComboF[ComboAt(xx+step,y+c)] == 67); return false; //invalid direction } void TraceToScreen(int y, int i){ Screen->DrawInteger(7, 8, y, FONT_Z1, 0x01, 0x0F, -1, -1, i, 4, 128); } ffc script Swarm{ void run(int initradius, int density, int damage, int speed, int intattractradius, int misc, int ffclink){ if(Game->GetCurScreen() == 0x42 && misc == 1 && Screen->State[ST_DOORRIGHT] == true) Quit(); int radius = initradius; int movespeed = 0.25; int initx = this->X; int inity = this->Y; int maxspeed = speed; if(maxspeed == 0) maxspeed = 12; int attractradius = intattractradius; if(intattractradius == 0) attractradius = radius *3; int SwarmX[100]; int SwarmY[100]; int SwarmVx[100]; int SwarmVy[100]; int SwarmCombo[100]; for(int i = 0; i 0 && Rand(0,1) == 0) SwarmCombo[i] = 3935; SwarmX[i] = this->X + VectorX(Rand(0, radius), Rand(0,359)); SwarmY[i] = this->Y + VectorY(Rand(0, radius), Rand(0,359)); do{ SwarmVx[i] = Rand(-1*maxspeed , maxspeed) * 0.25; } while (SwarmVx[i] == 0); do{ SwarmVy[i] = Rand(-1*maxspeed, maxspeed) * 0.25; } while (SwarmVy[i] == 0); } while(true){ if(ffclink > 0){ ffc f = Screen->LoadFFC(ffclink); initx = f->X; inity = f->Y; } for(int i = 0; iX, this->Y) > radius){ int angle = Angle(this->X, this->Y, SwarmX[i], SwarmY[i]); if(angle < 0 && angle >= -90){ //Quadrant 1 SwarmVx[i] = -1 * Abs(SwarmVx[i]); SwarmVy[i] = Abs(SwarmVy[i]); } if((angle <= -90 && angle >= -180) || angle == 180){ //Quadrant 2 SwarmVx[i] = Abs(SwarmVx[i]); SwarmVy[i] = Abs(SwarmVy[i]); } if(angle >= 0 && angle < 90){ //Quadrant 4 SwarmVx[i] = -1 * Abs(SwarmVx[i]); SwarmVy[i] = -1 * Abs(SwarmVy[i]); } if(angle >= 90 && angle < 180){ //Quadrant 3 SwarmVx[i] = Abs(SwarmVx[i]); SwarmVy[i] = -1 * Abs(SwarmVy[i]); } } int flip; if(SwarmVx[i] > 0) flip = 1; Screen->DrawCombo(5, SwarmX[i], SwarmY[i], SwarmCombo[i], 1, 1, 0, -1, -1, 0, 0, 0, 0, flip, true, OP_OPAQUE); } if(G[G_FISHORBACTIVE] == 1 && damage > 0){ int distance = LargeDistance(this->X, this->Y, G[G_FISHORBX], G[G_FISHORBY]); int angleto = Angle(this->X, this->Y, G[G_FISHORBX], G[G_FISHORBY]); int angleaway = Angle(G[G_FISHORBX], G[G_FISHORBY], this->X, this->Y); if(G[G_FISHORBSTATE] == 0 && distance < attractradius){ //Attract this->X += VectorX(movespeed, angleto); this->Y += VectorY(movespeed, angleto); } if(G[G_FISHORBSTATE] == 1 && distance < attractradius){ //Repel this->X += VectorX(movespeed, angleaway); this->Y += VectorY(movespeed, angleaway); if(distance < initradius) radius = initradius * (initradius - distance + 1); } if(distance >= attractradius && Distance(this->X, this->Y, initx, inity) > 0){ int angletoto = Angle(this->X, this->Y, initx, inity); this->X += VectorX(movespeed, angletoto); this->Y += VectorY(movespeed, angletoto); } } else if(G[G_FISHORBACTIVE] == 0 && damage > 0){ if(LargeDistance(this->X, this->Y, initx, inity) > 0){ int angletoto = Angle(this->X, this->Y, initx, inity); this->X += VectorX(movespeed, angletoto); this->Y += VectorY(movespeed, angletoto); } } if(radius > initradius && (G[G_FISHORBACTIVE] == 0 || Distance(this->X, this->Y, G[G_FISHORBX], G[G_FISHORBY]) >= initradius)){ radius -= 3; } if(damage > 0){ if(LargeDistance(Link->X, Link->Y, this->X, this->Y) < radius && !(G[G_FISHORBACTIVE] == 1 && G[G_FISHORBSTATE] == 1)) DamageLink(damage); for(int i = Screen->NumNPCs(); i>0; i--){ npc n = Screen->LoadNPC(i); if(n->ID == 258 && LargeDistance(this->X, this->Y, n->X, n->Y) < radius && !(G[G_FISHORBACTIVE] == 1 && G[G_FISHORBSTATE] == 1 && LargeDistance(Link->X, Link->Y, this->X, this->Y) < radius)) n->HP = 0; } } // Screen->Circle(3, this->X, this->Y, radius, 1, 1, 0, 0, 0, 0, OP_OPAQUE); Waitframe(); } } } ffc script SplittingWalker{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this, enemyID); int originaldata = Ghost_Data; Ghost_Data = 1; Ghost_Waitframes(this, ghost, true, true,8); Ghost_Data = originaldata; Ghost_SetFlag(GHF_NORMAL); //Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); bool hugging; // int hugtarget; int maxhp = Ghost_HP; int walkcounter = -1; // int walktarget; // int targettimer = Rand(180, 240); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE) // walktarget = Rand(0,1); int splittingtype = ghost->Attributes[1]; int splitenemyID = ghost->Attributes[2]; int splitenemynumber = ghost->Attributes[3]; while(true){ if(!hugging){ if(G[G_HUGGED] > 0) G[G_HUGGED] --; // if(G[G_DIFFICULTY] == DIF_VHARD) // walkcounter = Ghost_2PlayerHaltingWalk4(walkcounter, ghost->Step+50, ghost->Rate-1, ghost->Homing+30, ghost->Hunger, ghost->Haltrate-1, 48, walktarget); // else // walkcounter = Ghost_2PlayerHaltingWalk4(walkcounter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger, ghost->Haltrate, 48, walktarget); walkcounter = Ghost_HaltingWalk4(walkcounter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger, ghost->Haltrate, 48); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // targettimer--; // if(targettimer == 0){ // if(Rand(0,1) == 1) // walktarget = Rand(0,1); // targettimer = Rand(180,240); // } // } if(ghost->ID != 274){ if(LinkCollision(ghost) && Link->Action == LA_GOTHURTLAND && Link->X >= 24 && Link->Y >=24 && Link->X <232 && Link->Y <152 && G[G_HUGGED] == 0){ Ghost_X = Link->X; Ghost_Y = Link->Y; hugging = true; this->Flags[FFCF_OVERLAY] = true; Ghost_UnsetFlag(GHF_KNOCKBACK); ghost->DrawYOffset = 0; Ghost_UnsetFlag(GHF_CLOCK); Ghost_UnsetFlag(GHF_STUN); // hugtarget = 0; } // else if(G[G_MULTIPLAYER_ENABLED] == I_TRUE && (Distance(Ghost_X, Ghost_Y, G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y]) < 14 && G[G_PLAYER_TWO_IFRAMES] >0 && G[G_PLAYER_TWO_X] >= 24 && G[G_PLAYER_TWO_Y] >=24 && G[G_PLAYER_TWO_X] <232 && G[G_PLAYER_TWO_Y] <152 && G[G_PLAYER_TWO_HUG] == 0 && G[G_DIFFICULTY] != DIF_EASY)){ // Ghost_X = G[G_PLAYER_TWO_X]; // Ghost_Y = G[G_PLAYER_TWO_FIRINGY]; // hugging = true; // this->Flags[FFCF_OVERLAY] = true; // Ghost_UnsetFlag(GHF_KNOCKBACK); // ghost->DrawYOffset = 0; // Ghost_UnsetFlag(GHF_CLOCK); // Ghost_UnsetFlag(GHF_STUN); // hugtarget = 1; // } } } else if(hugging){ // if(hugtarget == 0){ G[G_HUGGED] = 10; if(Link->Action == LA_GOTHURTLAND){ Link->Action = LA_NONE; } Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->X = Ghost_X; Link->Y = Ghost_Y; // ghost->DrawYOffset = G[G_FIRING_Y]-Link->Y; // } // else if(hugtarget == 1){ // G[G_PLAYER_TWO_HUG] = 10; // if(G[G_PLAYER_TWO_KNOCKBACK_DIR] != -1){ // G[G_PLAYER_TWO_KNOCKBACK_DIR] = -1; // G[G_PLAYER_TWO_ACTION] = LA_NONE; // } // Link->InputEx1 = false; // Link->InputEx2 = false; // Link->InputEx3 = false; // Link->InputEx4 = false; // G[G_PLAYER_TWO_X] = Ghost_X; // G[G_PLAYER_TWO_Y] = Ghost_Y; // ghost->DrawYOffset = G[G_PLAYER_TWO_FIRINGY]-G[G_PLAYER_TWO_Y]; // } } if(ghost->Misc[8] == 1){ Ghost_Y = -1000; Ghost_Waitframe(this, ghost, true, true); Quit(); } if(splittingtype == 2 && Ghost_Y > -1 && (Ghost_HP <= 0 || !ghost->isValid()) && ghost->Misc[8] == 0){ Link->CollDetection = true; for(int i = splitenemynumber; i >0; i--){ npc spawnedenemy = CreateNPCAt(splitenemyID, Ghost_X, Ghost_Y); spawnedenemy->CollDetection = false; spawnedenemy->Misc[5] = 1; if(ghost->isValid()) spawnedenemy->Stun = ghost->Stun; lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, Ghost_X, Ghost_Y); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; } Ghost_Data = 1; Ghost_Waitframes(this, ghost, false, false,8); for(int i = Screen->NumNPCs(); i >0; i--){ npc n = Screen->LoadNPC(i); if(n->ID == splitenemyID && n->Misc[5] == 1) n->CollDetection = true; } Quit(); } else if(splittingtype == 1 && Ghost_Y > -1 && Ghost_HP < maxhp && Ghost_HP > 0 && ghost->Misc[8] == 0){ Ghost_Data = 1; for(int i = splitenemynumber; i >0; i--){ npc spawnedenemy = CreateNPCAt(splitenemyID, Ghost_X, Ghost_Y); spawnedenemy->CollDetection = false; spawnedenemy->Misc[5] = 1; if(ghost->isValid()) spawnedenemy->Stun = ghost->Stun; lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, spawnedenemy->X, spawnedenemy->Y); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; } ghost->Y = -1000; Ghost_Waitframes(this, ghost, false, false,8); for(int i = Screen->NumNPCs(); i >0; i--){ npc n = Screen->LoadNPC(i); if(n->ID == splitenemyID && n->Misc[5] == 1) n->CollDetection = true; } ghost->Y = -1000; Ghost_HP = 0; Ghost_Data =0; Quit(); } else if(splittingtype == 1 && Ghost_HP <= 0 && ghost->Misc[8] == 0){ Ghost_Waitframe(this, ghost, true, true); } Ghost_Waitframe(this, ghost, false, false); } } } ffc script FishOrbSpawn{ //Script 16 void run(int state, int scriptspawn){ int truestate = state; if(this->Misc[0] == 1) truestate = 1; int statewait = 0; int initx; int inity; if(this->Misc[1] == 1){ initx = Link->X; inity = Link->Y; for(int i = 0; i<60; i++){ Screen->DrawCombo(2, this->X, this->Y, 3940, 1, 1, truestate+7, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); Waitframe(); } } if(G[G_FISHORBACTIVE] == 1) Quit(); while(G[G_FISHORBCREATED] == 0 && Game->GetCurDMap() != 31) Waitframe(); while(true){ while(true){ if((Distance(Link->X, Link->Y, this->X, this->Y) <= 8 || ((Screen->ComboS[ComboAt(this->X+8, this->Y+8)] != 0 || Screen->ComboS[ComboAt(this->X+2, this->Y+2)] != 0 || Screen->ComboS[ComboAt(this->X+14, this->Y+14)] != 0 || GetLayerComboS(1, ComboAt(this->X+8, this->Y+8)) != 0 || GetLayerComboS(1, ComboAt(this->X+2, this->Y+2)) != 0 || GetLayerComboS(1, ComboAt(this->X+14, this->Y+14)) != 0) && Distance(Link->X, Link->Y, this->X, this->Y) <= 16))) break; if(Screen->ComboS[ComboAt(this->X+8, this->Y+8)] != 0 || GetLayerComboS(1, ComboAt(this->X+8, this->Y+8)) != 0){ if(G[G_GLOBALFRAMES] % 3 == 0){ if(this->X > initx) this->X--; if(this->X < initx) this->X++; if(this->Y > inity) this->Y--; if(this->Y < inity) this->Y++; } } for(int i = 1; i<=Screen->NumLWeapons(); i++){ lweapon l = Screen->LoadLWeapon(i); if(l->ID == LW_ARROW && Collision (this, l) && statewait == 0){ Game->PlaySound(77); statewait = 60; if(truestate == 0) truestate = 1; else truestate = 0; } } if(statewait > 0) statewait--; Screen->DrawCombo(2, this->X, this->Y, 3940, 1, 1, truestate+7, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); Waitframe(); } int angle = Angle(Link->X, Link->Y, this->X, this->Y); G[G_FISHORBANGLE] = angle; G[G_FISHORBX] = Link->X + VectorX(16, angle); G[G_FISHORBY] = Link->Y + VectorY(16, angle); G[G_FISHORBACTIVE] = 1; G[G_FISHORBSTATE] = truestate; Game->PlaySound(21); Quit(); Waitframe(); } } } void FishOrb(){ if(G[G_FISHORBACTIVE] == 1){ G[G_FISHORBANGLE]+=2; if(G[G_FISHORBANGLE] > 360) G[G_FISHORBANGLE] -= 360; G[G_FISHORBX] = Link->X + VectorX(16, G[G_FISHORBANGLE]); G[G_FISHORBY] = Link->Y + VectorY(16, G[G_FISHORBANGLE]); Screen->DrawCombo(2, G[G_FISHORBX], G[G_FISHORBY], 3939, 1, 1, G[G_FISHORBSTATE]+7, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); if(G[G_FISHORBDROP] == 1){ Game->PlaySound(21); G[G_FISHORBDROP] = 0; G[G_FISHORBACTIVE] = 0; ffc f = FindFreeFFC(); f->X = G[G_FISHORBX]; f->Y = G[G_FISHORBY]; f->Script = 16; f->InitD[0] = G[G_FISHORBSTATE]; f->InitD[1] = 1; f->Misc[0] = G[G_FISHORBSTATE]; f->Misc[1] = 1; G[G_FISHORBDROPPEDDMAP] = Game->GetCurDMap(); G[G_FISHORBDROPPEDSCREEN] = Game->GetCurScreen(); G[G_FISHORBDROPPEDX] = G[G_FISHORBX]; G[G_FISHORBDROPPEDY] = G[G_FISHORBY]; } if(G[G_FISHORBCOOL] > 0) G[G_FISHORBCOOL]--; } else{ if(Game->GetCurDMap() == G[G_FISHORBDROPPEDDMAP] && Game->GetCurScreen() == G[G_FISHORBDROPPEDSCREEN]){ if(CountFFCsRunning(16) == 0){ ffc f = FindFreeFFC(); f->X = G[G_FISHORBDROPPEDX]; f->Y = G[G_FISHORBDROPPEDY]; f->Script = 16; f->InitD[0] = G[G_FISHORBSTATE]; f->InitD[1] = 1; f->Misc[0] = G[G_FISHORBSTATE]; f->Misc[1] = 1; } } } } ffc FindFreeFFC(){ //A function modified from FFC Script to grab unused FFCs, but not necessarily do anything with them. for(int i=FFCS_MIN_FFC; i<=FFCS_MAX_FFC; i++){ ffc theFFC=Screen->LoadFFC(i); if(theFFC->Script==0 && theFFC->Data==0){ theFFC->Vx = 0; theFFC->Vy = 0; theFFC->TileWidth = 1; theFFC->TileHeight = 1; theFFC->EffectWidth = 16; theFFC->EffectHeight = 16; for(int i = 0; i < 8; i++){ theFFC->InitD[i] = 0; } for(int i = 0; i < 16; i++){ theFFC->Misc[i] = 0; } for(int i = 0; i < 11; i++){ theFFC->Flags[i] = 0; } theFFC->Link = GetFFCNumber(theFFC); return(theFFC); break; } } } item script Arrow{ void run(int identifier){ if(Game->Counter[CR_RUPEES] > 0){ if(identifier == 13){ lweapon arrow = CreateLWeaponAt(LW_ARROW, Link->X + RussInFrontX(Link->Dir, 0), Link->Y + RussInFrontY(Link->Dir, 0)); arrow->Damage = (250 + 2.5*G[G_WEAPON_MULTIPLIER]) * 0.5; arrow->UseSprite(10); arrow->Dir = Link->Dir; arrow->Step = 200; if(Link->Item[68]) arrow->Step = 350; ArrowFlip(arrow); } else{ for(int i = -16; i <= 16; i+=16){ lweapon arrow; if(Link->Dir == DIR_UP || Link->Dir == DIR_DOWN) arrow = CreateLWeaponAt(LW_ARROW, Link->X+ RussInFrontX(Link->Dir, 0)+i, Link->Y+ RussInFrontY(Link->Dir, 0)); else if(Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT) arrow = CreateLWeaponAt(LW_ARROW, Link->X+ RussInFrontX(Link->Dir, 0), Link->Y+ RussInFrontY(Link->Dir, 0)+i); arrow->Damage = (250 + 2.5*G[G_WEAPON_MULTIPLIER]) * 0.5; arrow->UseSprite(155); arrow->Dir = Link->Dir; arrow->Step = 200; if(Link->Item[68]) arrow->Step = 350; ArrowFlip2(arrow); } } Game->PlaySound(1); Game->Counter[CR_RUPEES]--; Link->Action = LA_ATTACKING; } } } void ArrowFlip(lweapon light){ if(light->Dir == DIR_UP){ //Do nothing } else if(light->Dir == DIR_DOWN) light->Flip = 2; else if(light->Dir == DIR_LEFT){ light->UseSprite(11); light->Flip = 1; } else if(light->Dir == DIR_RIGHT) light->UseSprite(11); } void ArrowFlip2(lweapon light){ if(light->Dir == DIR_UP){ //Do nothing } else if(light->Dir == DIR_DOWN) light->Flip = 2; else if(light->Dir == DIR_LEFT){ light->UseSprite(156); light->Flip = 1; } else if(light->Dir == DIR_RIGHT) light->UseSprite(156); } int RussInFrontX(int dir, int dist) { int x = 0; if(dir == DIR_LEFT) x = -16-dist; else if(dir == DIR_RIGHT) x = 16+dist; return x; } int RussInFrontY(int dir, int dist){ int y = 0; if(dir == DIR_UP) y = -16-dist; else if(dir == DIR_DOWN) y = 16+dist; return y; } const int TIL_HAMMER = 22700; ffc script Terrorpin{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); int Combo = ghost->Attributes[10]; int StoredDefenses[18]; Ghost_StoreDefenses(ghost, StoredDefenses); Ghost_SetAllDefenses(ghost, NPCDT_BLOCK); ghost->Defense[NPCD_FIRE] = NPCDT_IGNORE; Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); int KnockbackFrames; int KnockbackAngle; while(true){ while(true){ if(KnockbackFrames>0){ KnockbackFrames--; Ghost_MoveAtAngle(KnockbackAngle, ghost->Step/50, 0); } else{ if(DetectSwordCollision(ghost)){ KnockbackFrames = 16; KnockbackAngle = Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)+Rand(-30, 30); } else{ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y), ghost->Step/100, 0); } } Ghost_Waitframe(this, ghost); } // Ghost_Data = Combo+1; // Ghost_Jump = 1.6; // while(Ghost_Jump>0||Ghost_Z>0){ // Ghost_Waitframe(this, ghost); // } // Ghost_Data = Combo+2; // Ghost_SetDefenses(ghost, StoredDefenses); // for(int i=0; i<240&&!DetectHammer(); i++){ // if(i==180) // Ghost_Data = Combo+3; // Ghost_Waitframe(this, ghost); // } // Ghost_Data = Combo+4; // Ghost_Jump = 1.6; // ghost->CollDetection = false; // while(Ghost_Jump>0||Ghost_Z>0){ // Ghost_Waitframe(this, ghost); // } // Ghost_Data = Combo; // ghost->CollDetection = true; // Ghost_SetAllDefenses(ghost, NPCDT_BLOCK); // ghost->Defense[NPCD_FIRE] = NPCDT_IGNORE; } } bool DetectSwordCollision(npc n){ for(int i=1; i<=Screen->NumLWeapons()&&i<=10; i++){ lweapon l = Screen->LoadLWeapon(i); if((l->ID==LW_MAGIC)&&Collision(l, n)) return true; } return false; } bool DetectHammer(){ for(int i=1; i<=Screen->NumLWeapons()&&i<=10; i++){ lweapon l = Screen->LoadLWeapon(i); if(l->ID==LW_HAMMER&&l->CollDetection&&(l->Tile==TIL_HAMMER+3||l->Tile==TIL_HAMMER+6||l->Tile==TIL_HAMMER+9)&&Distance(CenterX(l), CenterY(l), Ghost_X+8, Ghost_Y+8)<40) return true; } return false; } } bool CanOpenSubscreen(){ if(G[G_IN_CUTSCENE] == I_TRUE) return false; if(G[G_NOSUBSCREEN] == I_TRUE) return false; return true; } bool SubscreenOpen(){ if(G[G_SUBSCREENOPEN] == I_TRUE) return true; return false; } void DrawTimeHHMMSS(int layer, int x, int y, int font, int color1, int color2, int format, int hours, int minutes, int seconds, bool drawblank){ int secondsa = Floor((seconds%60)/10); int secondsb = (seconds%60)%10; int minutesa = Floor((minutes%60)/10); int minutesb = (minutes%60)%10; int hoursa = Floor(hours/10); int hoursb = hours%10; int string[9] = {hoursa+48, hoursb+48, 58, minutesa+48, minutesb+48, 58, secondsa+48, secondsb+48, 0}; int stringnull[] = "--:--:--"; if(drawblank){ drawStringBordered(layer, x, y, font, color1, color2, format, stringnull, 128); } else{ drawStringBordered(layer, x, y, font, color1, color2, format, string, 128); } } void DrawTimeHHMMSSFF(int layer, int x, int y, int font, int color1, int color2, int format, int hours, int minutes, int seconds, int frames, bool drawblank){ int framesa = Floor((frames%60)/10); int framesb = (frames%60)%10; int secondsa = Floor((seconds%60)/10); int secondsb = (seconds%60)%10; int minutesa = Floor((minutes%60)/10); int minutesb = (minutes%60)%10; int hoursa = Floor(hours/10); int hoursb = hours%10; int string[12] = {hoursa+48, hoursb+48, 58, minutesa+48, minutesb+48, 58, secondsa+48, secondsb+48, 58, framesa+48, framesb+48, 0}; int stringnull[] = "--:--:--:--"; if(drawblank){ drawStringBordered(layer, x, y, font, color1, color2, format, stringnull, 128); } else{ drawStringBordered(layer, x, y, font, color1, color2, format, string, 128); } } void CountPlayTime(){ if(CanOpenSubscreen() && !SubscreenOpen() && G[G_STOPTIMER] == 0) G[G_SUBTIME_FRAMES]++; //Play Time Counting if(G[G_SUBTIME_FRAMES]>=60){ if(G[G_SUBTIME_SECS]==59&&G[G_SUBTIME_MINS]==59&&G[G_SUBTIME_HOURS]==99){ G[G_SUBTIME_FRAMES] = 59; } else{ G[G_SUBTIME_SECS]++; G[G_SUBTIME_FRAMES] = 0; } } if(G[G_SUBTIME_SECS]>=60){ if(G[G_SUBTIME_MINS]==59&&G[G_SUBTIME_HOURS]==99){ G[G_SUBTIME_SECS] = 59; } else{ G[G_SUBTIME_MINS]++; G[G_SUBTIME_SECS] = 0; } } if(G[G_SUBTIME_MINS]>=60){ if(G[G_SUBTIME_HOURS]==99){ G[G_SUBTIME_MINS] = 59; } else{ G[G_SUBTIME_HOURS] = Min(G[G_SUBTIME_HOURS]+1, 99); G[G_SUBTIME_MINS] = 0; } } } const int CMB_SCREENFREEZEA = 1260; const int CMB_SCREENFREEZEB = 1261; const int FFC_SCREENFREEZEA = 32; const int FFC_SCREENFREEZEB = 31; void FreezeScreen(){ ffc sfa = Screen->LoadFFC(FFC_SCREENFREEZEA); sfa->Data = CMB_SCREENFREEZEA; ffc sfb = Screen->LoadFFC(FFC_SCREENFREEZEB); sfb->Data = CMB_SCREENFREEZEB; } void UnfreezeScreen(){ ffc sfa = Screen->LoadFFC(FFC_SCREENFREEZEA); sfa->Data = FFCS_INVISIBLE_COMBO; ffc sfb = Screen->LoadFFC(FFC_SCREENFREEZEB); sfb->Data = FFCS_INVISIBLE_COMBO; } void TabletFreeze(){ ffc sfa = Screen->LoadFFC(FFC_SCREENFREEZEA); sfa->Data = CMB_SCREENFREEZEA; for(int i = Screen->NumNPCs(); i >0; i--){ npc enemy = Screen->LoadNPC(i); enemy->Stun = -1; } __ghzhData[__GHI_CLOCK_TIMER]=-1; } void TabletUnfreeze(){ ffc sfa = Screen->LoadFFC(FFC_SCREENFREEZEA); sfa->Data = FFCS_INVISIBLE_COMBO; for(int i = Screen->NumNPCs(); i >0; i--){ npc enemy = Screen->LoadNPC(i); enemy->Stun = 0; } __ghzhData[__GHI_CLOCK_TIMER]=0; } int GetItemIndex(int positionsarray, int position){ int NumPositions = SizeOfArray(positionsarray); for(int i = 0; i < NumPositions; i++){ if(positionsarray[i] == position) return i; } } int TangoCharacterWidth(int character){ int width = TANGO_FONT_LTTP_SMALL[character-32+6]; return width; } int CountStringLength(int String){ int count; int numspaces; for(int i = 0; i < SizeOfArray(String); i++){ if(String[i] != 0){ int thischaracter = String[i]; count += TangoCharacterWidth(thischaracter); if(String[i] == 32) numspaces++; else numspaces = 0; if(numspaces >= 5){ count -= TangoCharacterWidth(thischaracter)*numspaces; return count; } } else{ return count; } } } const int SUB_ITEMCOLUMNS = 5; //Number of items per row in the subscreen const int SUB_PASSIVECOLUMNS = 2; //Number of items per row of the passive items box const int SUB_MAINBOX_X = 42; //Main anchor point for the whole subscreen. Most other elements are moved relative to this. const int SUB_MAINBOX_Y = 38; const int SUB_ITEMBOX_X = 40; //Position of the item selection box, as an OFFSET RELATIVE TO MAIN ANCHOR POINT const int SUB_ITEMBOX_Y = 0; const int SUB_STATS_X = 8; //Stats box offset X const int SUB_STATS_Y = 0; const int SUB_COLOR = 0x68; //Color for subscreen boxes const int SUB_TIMERX = 208; //Location of the play timer. (Independent of the main box.) const int SUB_TIMERY = 8; const int SUB_STORYBOX_X = 144; //Story McGuffin box offsets const int SUB_STORYBOX_Y = 0; const int SUB_STORYBOX_WIDTH = 40; //Story McGuffin box size in pixels const int SUB_STORYBOX_HEIGHT = 40; const int SUB_TEARSX = 204; //Location of Tears count, independent of main box. const int SUB_TEARSY = 86; const int SUB_COUNTERSX = 97; //Location of counters, independent of main box. const int SUB_COUNTERSY = 116; const int CMB_SUBSELECTOR = 1258; //Combo for the item selector. Should be 8-bit. const int TIL_ATK = 582; const int TIL_DEF = 583; const int TIL_SPD = 584; //Sword (Wooden) Boomerang Bombs Arrows Candle Hookshot Ladder Wand Mirror Potion int ItemIDs[] = {203, 23, 3, 13, 11, 52, 27, 25, 186, 29}; int ItemTiles[] = {19761, 21347, 21691, 21895, 22120, 22560, 22942, 22420, 52098, 22327}; int ItemCSets[] = {7, 8, 7, 8, 8, 7, 8, 7, 1, 7}; int Positions[] = {0, 1, 2, 3, 4, 7, 5, 6, 8, 9}; //Bracelet Compass Ice Book Lightning Book int PassiveIDs[] = {19, 174, 213, 32}; int PassiveTiles[] = {23025, 23420, 22428, 22428}; int PassiveCSets[] = {8, 8, 7, 8}; int PPositions[] = {0, 1, 2, 3}; void ActiveSubscreen(){ if(G[G_SUBSCREEN_DELAY] > 0){ G[G_SUBSCREEN_DELAY] --; float xnum = 4.3; float ynum = 2.9; if(G[G_SUBSCREENOPEN] == I_FALSE){ //Subscreen delay and opening/closing effect if(G[G_SUBSCREEN_DELAY] == 0) UnfreezeScreen(); else Screen->Rectangle(6, 128 - (xnum*G[G_SUBSCREEN_DELAY]), 88 - (ynum*G[G_SUBSCREEN_DELAY]), 128 + (xnum*G[G_SUBSCREEN_DELAY]), 88 + (ynum*G[G_SUBSCREEN_DELAY]), 0, 1, 0, 0, 0, true, 128); } else{ if(G[G_SUBSCREEN_DELAY] != 0) Screen->Rectangle(6, 128 - (xnum*(30-G[G_SUBSCREEN_DELAY])), 88 - (ynum*(30-G[G_SUBSCREEN_DELAY])), 128 + (xnum*(30-G[G_SUBSCREEN_DELAY])), 88 + (ynum*(30-G[G_SUBSCREEN_DELAY])), 0, 1, 0, 0, 0, true, 128); } } if(!SubscreenOpen() && CanOpenSubscreen() && Link->PressStart){ //Opening/Closing Subscreen G[G_SUBSCREENAREA] = G[G_LASTAREA]; Link->PressStart = false; Link->InputStart = false; G[G_SUBSCREENOPEN] = I_TRUE; // G[G_SUBSCREENAREA] = GetAreaID(Game->GetCurDMap()); // if(G[G_SUBSCREENAREA] == -1) // G[G_SUBSCREENAREA] = G[G_LASTAREA]; // else // G[G_LASTAREA] = G[G_SUBSCREENAREA]; FreezeScreen(); } if(SubscreenOpen() && G[G_SUBSCREEN_DELAY] == 0){ if(Link->PressStart){ G[G_SUBSCREENAREA] = G[G_LASTAREA]; Link->PressA = false; Link->PressB = false; Link->PressL = false; Link->PressR = false; Link->PressUp = false; Link->PressDown = false; Link->PressLeft = false; Link->PressRight = false; G[G_SUBSCREENOPEN] = I_FALSE; if(true){ //I'm using if(true) to preserve this structure in case you want an opening/closing subscreen delay effect UnfreezeScreen(); } else{ G[G_SUBSCREEN_DELAY] = 30; float xnum = 4.3; float ynum = 2.9; Screen->Rectangle(6, 128 - (xnum*G[G_SUBSCREEN_DELAY]), 88 - (ynum*G[G_SUBSCREEN_DELAY]), 128 + (xnum*G[G_SUBSCREEN_DELAY]), 88 + (ynum*G[G_SUBSCREEN_DELAY]), 0, 1, 0, 0, 0, true, 128); } Link->PressStart = false; Link->InputStart = false; } } if(SubscreenOpen() && G[G_SUBSCREEN_DELAY] == 0){ if(Link->Item[RING_RIGGS]){ //Put sword vs chains on the subscreen depending on which character you're playing and if they've been upgraded if(Link->Item[207]){ ItemIDs[0] = 207; ItemTiles[0] = 19900; ItemCSets[0] = 1; } else{ ItemIDs[0] = 206; ItemTiles[0] = 19880; ItemCSets[0] = 11; } } else if(Link->Item[RING_ALIYA]){ ItemIDs[0] = 216; ItemTiles[0] = 30700; ItemCSets[0] = 8; } else{ if(Link->Item[205]){ ItemIDs[0] = 205; ItemTiles[0] = 19780; ItemCSets[0] = 7; } else{ ItemIDs[0] = 203; ItemTiles[0] = 19761; ItemCSets[0] = 7; } } int position = G[G_SUBPOSITION]; Screen->Rectangle(6, 0, 0, 255, 175, 0, 1, 0, 0, 0, true, 128); //Black Background int ItemStart = SUB_MAINBOX_X+SUB_ITEMBOX_X+2; int Weapons[] = "Weapons"; Screen->DrawString(6, ItemStart, 31, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Weapons, OP_OPAQUE); int NumPositions = SizeOfArray(Positions); for(int i = 0; i < NumPositions; i++){ //Draw item graphics int itemID = ItemIDs[i]; int currposition = Positions[i]; if(Link->Item[itemID]) Screen->FastTile(6, ItemStart+(currposition%SUB_ITEMCOLUMNS)*20, 40+Floor(currposition/SUB_ITEMCOLUMNS)*20, ItemTiles[i], ItemCSets[i], OP_OPAQUE); } //Main inventory box int ItemboxHeight = (1+Floor((NumPositions-1)/SUB_ITEMCOLUMNS))*20; int ItemboxBottom = SUB_MAINBOX_Y+SUB_ITEMBOX_Y+ItemboxHeight; Screen->Rectangle(6, SUB_MAINBOX_X+SUB_ITEMBOX_X, SUB_MAINBOX_Y+SUB_ITEMBOX_Y, SUB_MAINBOX_X+SUB_ITEMBOX_X+20*SUB_ITEMCOLUMNS-1, ItemboxBottom, SUB_COLOR, 1, 0, 0, 0, false, OP_OPAQUE); int DefOff = 10; int SpdOff = 20; int Stats[] = "Stats"; //Screen->DrawString(6, SUB_MAINBOX_X+SUB_STATS_X-18, SUB_MAINBOX_Y+SUB_STATS_Y-7, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Stats, OP_OPAQUE); Screen->DrawString(6, SUB_MAINBOX_X+SUB_STATS_X+2, SUB_MAINBOX_Y+SUB_STATS_Y-7, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Stats, OP_OPAQUE); Screen->Rectangle(6, SUB_MAINBOX_X+SUB_STATS_X, SUB_MAINBOX_Y+SUB_STATS_Y, SUB_MAINBOX_X+SUB_STATS_X+23, SUB_MAINBOX_Y+SUB_STATS_Y+29, SUB_COLOR, 1, 0, 0, 0, false, OP_OPAQUE); int ATK = G[G_WEAPON_MULTIPLIER]; int DEF; int DMG = G[G_DAMAGE_MULTIPLIER]/8; if(100*G[G_DAMAGE_MULTIPLIER]/8 > 100) DEF = 100 - (G[G_DAMAGE_MULTIPLIER]/8*100-100)/2; if(100*G[G_DAMAGE_MULTIPLIER]/8 < 100) DEF = 100 - (G[G_DAMAGE_MULTIPLIER]/8*100-100)*2; if(100*G[G_DAMAGE_MULTIPLIER]/8 == 100) DEF = 100; if(G[G_STATSRANDO] != 0 && DEF <= 50){ if(G[G_DIFFICULTY] == DIF_HARD){ if((Link->Item[RING_RIGGS] || Link->Item[RING_RIGGSSWIM]) && (G[G_STATSRANDO] == 2 || G[G_STATSRANDO] == 3)) DEF = G[G_RIGGSCALCDEFENSE] * 0.75; else if(!Link->Item[RING_RIGGS] && !Link->Item[RING_RIGGSSWIM] && (G[G_STATSRANDO] == 1 || G[G_STATSRANDO] == 3)) DEF = G[G_KELLCALCDEFENSE] * 0.75; } if(G[G_DIFFICULTY] == DIF_VHARD){ if((Link->Item[RING_RIGGS] || Link->Item[RING_RIGGSSWIM]) && (G[G_STATSRANDO] == 2 || G[G_STATSRANDO] == 3)) DEF = G[G_RIGGSCALCDEFENSE] * 0.5; else if(!Link->Item[RING_RIGGS] && !Link->Item[RING_RIGGSSWIM] && (G[G_STATSRANDO] == 1 || G[G_STATSRANDO] == 3)) DEF = G[G_KELLCALCDEFENSE] * 0.5; } } if(Link->Item[RING_RIGGS] || Link->Item[RING_RIGGSSWIM]){ if(G[G_STATSRANDO] == 0 || G[G_STATSRANDO] == 1) G[G_LINKSPEED] = 123; else G[G_LINKSPEED] = G[G_RIGGSCALCSPEED]; } else{ if(G[G_STATSRANDO] == 0 || G[G_STATSRANDO] == 2) G[G_LINKSPEED] = 100; else G[G_LINKSPEED] = G[G_KELLCALCSPEED]; } int charactertile = 30424; if(Link->Item[RING_RIGGS]) charactertile = 30464; if(Link->Item[RING_ALIYA]) charactertile = 64215; int charactercset = 6; Screen->FastTile(6, SUB_MAINBOX_X+SUB_STATS_X-18, SUB_MAINBOX_Y+SUB_STATS_Y+2, charactertile, charactercset, OP_OPAQUE); //Character Screen->Rectangle(6, SUB_MAINBOX_X+SUB_STATS_X-20, SUB_MAINBOX_Y+SUB_STATS_Y, SUB_MAINBOX_X+SUB_STATS_X, SUB_MAINBOX_Y+SUB_STATS_Y+20, 0x68, 1, 0, 0, 0, false, OP_OPAQUE); Screen->FastTile(6, SUB_MAINBOX_X+SUB_STATS_X+2, SUB_MAINBOX_Y+SUB_STATS_Y+2, TIL_ATK, 7, OP_OPAQUE); //Offense Screen->DrawInteger(6, SUB_MAINBOX_X+SUB_STATS_X+12, SUB_MAINBOX_Y+SUB_STATS_Y+2, FONT_Z3SMALL,0x01, 0x00,-1, -1, ATK, 0, OP_OPAQUE); Screen->FastTile(6, SUB_MAINBOX_X+SUB_STATS_X+2, SUB_MAINBOX_Y+SUB_STATS_Y+2+DefOff, TIL_DEF, 6, OP_OPAQUE); //Defense Screen->DrawInteger(6, SUB_MAINBOX_X+SUB_STATS_X+12, SUB_MAINBOX_Y+SUB_STATS_Y+2+DefOff, FONT_Z3SMALL,0x01, 0x00,-1, -1, DEF, 0, OP_OPAQUE); Screen->FastTile(6, SUB_MAINBOX_X+SUB_STATS_X+2, SUB_MAINBOX_Y+SUB_STATS_Y+2+SpdOff, TIL_SPD, 7, OP_OPAQUE); //Speed Screen->DrawInteger(6, SUB_MAINBOX_X+SUB_STATS_X+12, SUB_MAINBOX_Y+SUB_STATS_Y+2+SpdOff, FONT_Z3SMALL,0x01, 0x00,-1, -1, G[G_LINKSPEED], 0, OP_OPAQUE); if(G[G_RIGGSJOINED] == I_TRUE){ int Ex1[] = "Ex1"; //if(G[G_GLOBALFRAMES] % 40 < 20){ if(Link->Item[RING_RIGGS] || Link->Item[RING_RIGGSSWIM] || Link->Item[RING_ALIYA]) Screen->FastTile(7, SUB_MAINBOX_X+SUB_STATS_X-21 , SUB_MAINBOX_Y+SUB_STATS_Y+2+SpdOff, 64196, 6, OP_OPAQUE); else{ if(G[G_ALIYAINPARTY] == 1) Screen->FastTile(7, SUB_MAINBOX_X+SUB_STATS_X-21 , SUB_MAINBOX_Y+SUB_STATS_Y+2+SpdOff, 64214, 6, OP_OPAQUE); else Screen->FastTile(7, SUB_MAINBOX_X+SUB_STATS_X-21 , SUB_MAINBOX_Y+SUB_STATS_Y+2+SpdOff, 64194, 6, OP_OPAQUE); } Screen->DrawString(7, SUB_MAINBOX_X+SUB_STATS_X-12, SUB_MAINBOX_Y+SUB_STATS_Y+2+SpdOff+1, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Ex1, OP_OPAQUE); //} } int BoxTop = SUB_MAINBOX_Y+SUB_STORYBOX_Y; int BoxSide = SUB_MAINBOX_X+SUB_STORYBOX_X; // Screen->Rectangle(6, BoxSide, BoxTop, BoxSide+SUB_STORYBOX_WIDTH, BoxTop+SUB_STORYBOX_HEIGHT, SUB_COLOR, 1, 0, 0, 0, false, OP_OPAQUE); //Story items box int PassiveStart = SUB_MAINBOX_X+SUB_STORYBOX_X+2; int Items[] = "Items"; Screen->DrawString(6, PassiveStart, 31, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Items, OP_OPAQUE); int NumPositions2 = SizeOfArray(PPositions); for(int i = 0; i < NumPositions2; i++){ //Draw passive graphics int itemID = PassiveIDs[i]; int currposition = PPositions[i]; if(Link->Item[itemID]) Screen->FastTile(6, PassiveStart+(currposition%SUB_PASSIVECOLUMNS)*20, 40+Floor(currposition/SUB_PASSIVECOLUMNS)*20, PassiveTiles[i], PassiveCSets[i], OP_OPAQUE); } int ItemboxHeight2 = (1+Floor((NumPositions2-1)/SUB_PASSIVECOLUMNS))*20; //Passive inventory box int ItemboxBottom2 = SUB_MAINBOX_Y+SUB_STORYBOX_Y+ItemboxHeight2; Screen->Rectangle(6, SUB_MAINBOX_X+SUB_STORYBOX_X, SUB_MAINBOX_Y+SUB_STORYBOX_Y, SUB_MAINBOX_X+SUB_STORYBOX_X+20*SUB_PASSIVECOLUMNS-1, ItemboxBottom2, SUB_COLOR, 1, 0, 0, 0, false, OP_OPAQUE); //Draw play time and completion percentage DrawTimeHHMMSS(7, SUB_TIMERX, SUB_TIMERY, FONT_Z3SMALL, 0x01, 0x0F, TF_NORMAL, G[G_SUBTIME_HOURS], G[G_SUBTIME_MINS], G[G_SUBTIME_SECS], false); //int Percent[] = "%"; // Screen->DrawInteger(6, SUB_TIMERX, SUB_TIMERY+8, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_RUPEES], 0, OP_OPAQUE); // Screen->DrawString(6, SUB_TIMERX+16, SUB_TIMERY+8, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Percent, OP_OPAQUE); int mpcounteroffset = 10; int hpcounteroffset = 20; int Slash[] = "/"; // if(Game->Counter[CR_SCRIPT1] >= 20){ // Screen->DrawString(6, SUB_COUNTERSX+5, SUB_COUNTERSY-hpcounteroffset, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); // Screen->FastTile(6, SUB_COUNTERSX-10, SUB_COUNTERSY-2-hpcounteroffset, 787, 6, OP_OPAQUE); // Screen->DrawInteger(6, SUB_COUNTERSX, SUB_COUNTERSY-hpcounteroffset, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_SCRIPT3], 0, OP_OPAQUE); // Screen->DrawInteger(6, SUB_COUNTERSX+10, SUB_COUNTERSY-hpcounteroffset, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_SCRIPT6], 0, OP_OPAQUE); // Screen->DrawString(6, SUB_COUNTERSX+5, SUB_COUNTERSY-mpcounteroffset, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); // Screen->FastTile(6, SUB_COUNTERSX-10, SUB_COUNTERSY-2-mpcounteroffset, 788, 9, OP_OPAQUE); // Screen->DrawInteger(6, SUB_COUNTERSX, SUB_COUNTERSY-mpcounteroffset, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_SCRIPT4], 0, OP_OPAQUE); // Screen->DrawInteger(6, SUB_COUNTERSX+10, SUB_COUNTERSY-mpcounteroffset, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_SCRIPT7], 0, OP_OPAQUE); // } // if(Game->Counter[CR_SCRIPT1] >= 40){ // Screen->DrawString(6, SUB_COUNTERSX+5, SUB_COUNTERSY, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); // Screen->FastTile(6, SUB_COUNTERSX-10, SUB_COUNTERSY-2, 265, 7, OP_OPAQUE); // Screen->DrawInteger(6, SUB_COUNTERSX, SUB_COUNTERSY, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_SCRIPT2], 0, OP_OPAQUE); // Screen->DrawInteger(6, SUB_COUNTERSX+10, SUB_COUNTERSY, FONT_Z3SMALL,0x01, 0x00,-1, -1, Game->Counter[CR_SCRIPT5], 0, OP_OPAQUE); // } Screen->DrawString(6, SUB_TEARSX+5, SUB_TEARSY, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); Screen->FastTile(6, SUB_TEARSX-14, SUB_TEARSY-6, 63365, 6, OP_OPAQUE); Screen->DrawInteger(6, SUB_TEARSX, SUB_TEARSY, FONT_Z3SMALL,0x01, 0x00,-1, -1, G[G_NUMTEARS], 0, OP_OPAQUE); Screen->DrawInteger(6, SUB_TEARSX+10, SUB_TEARSY, FONT_Z3SMALL,0x01, 0x00,-1, -1, 8, 0, OP_OPAQUE); if(G[G_TABLETRANDO] == 1){ int count; for(int i = G_TABLETSTART; i<=G_TABLETSTART+5; i++){ if(G[i] == 1) count++; } Screen->FastTile(6, SUB_TEARSX-14, SUB_TEARSY-6+16, 23121, 8, OP_OPAQUE); Screen->DrawString(6, SUB_TEARSX+5, SUB_TEARSY+16, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); Screen->DrawInteger(6, SUB_TEARSX, SUB_TEARSY+16, FONT_Z3SMALL,0x01, 0x00,-1, -1, count, 0, OP_OPAQUE); Screen->DrawInteger(6, SUB_TEARSX+10, SUB_TEARSY+16, FONT_Z3SMALL,0x01, 0x00,-1, -1, 6, 0, OP_OPAQUE); } if(G[G_RANDO] == 1){ int firststr[] = "Seed:"; Screen->DrawString(7, SUB_TEARSX-14, SUB_TEARSY+34, FONT_Z3SMALL, 0x01, 0, TF_NORMAL, firststr, 128); Screen->DrawInteger(7, SUB_TEARSX-14, SUB_TEARSY+34+8, FONT_Z3SMALL, 0x01, 0, -1, -1, G[G_SEED1], 0, 128); Screen->DrawInteger(7, SUB_TEARSX+4, SUB_TEARSY+34+8, FONT_Z3SMALL, 0x01, 0, -1, -1, G[G_SEED2], 0, 128); } if(Link->PressEx3){ int counter = G[G_SUBSCREENAREA]; do{ counter--; if(counter == -1) counter = 18; } while(G[G_AREAVISITEDSTART + counter] == 0); G[G_SUBSCREENAREA] = counter; } if(Link->PressEx4){ int counter = G[G_SUBSCREENAREA]; do{ counter++; if(counter == 19) counter = 0; } while(G[G_AREAVISITEDSTART + counter] == 0); G[G_SUBSCREENAREA] = counter; } int buffer[256]; Game->GetMessage(20 + G[G_SUBSCREENAREA], buffer); int Ex3[] = "Ex3"; int Ex4[] = "Ex4"; Screen->Line(7, SUB_COUNTERSX-8, SUB_COUNTERSY-2, SUB_COUNTERSX+75, SUB_COUNTERSY-2, SUB_COLOR, 1, 0, 0, 0, OP_OPAQUE); Screen->FastTile(7, SUB_COUNTERSX-8, SUB_COUNTERSY+10, 64198, 6, OP_OPAQUE); Screen->FastTile(7, SUB_COUNTERSX+72, SUB_COUNTERSY+10, 64199, 6, OP_OPAQUE); Screen->DrawString(7, SUB_COUNTERSX-3, SUB_COUNTERSY+10, FONT_Z3SMALL, 0x69, 0x00, TF_NORMAL, Ex3, OP_OPAQUE); Screen->DrawString(7, SUB_COUNTERSX+59, SUB_COUNTERSY+10, FONT_Z3SMALL, 0x69, 0x00, TF_NORMAL, Ex4, OP_OPAQUE); Screen->DrawString(6, SUB_COUNTERSX-16+Floor(.5*(100-CountStringLength(buffer))), SUB_COUNTERSY, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, buffer, OP_OPAQUE); Screen->FastTile(6, SUB_COUNTERSX+22, SUB_COUNTERSY+8, 24, 7, OP_OPAQUE); Screen->DrawInteger(6, SUB_COUNTERSX+32, SUB_COUNTERSY+10, FONT_Z3SMALL,0x01, 0x00,-1, -1, G[G_AREAITEMSSTART+G[G_SUBSCREENAREA]], 0, OP_OPAQUE); if(Link->Item[174]){ if(G[G_SUBSCREENAREA] == 0 && G[G_AREAITEMSSTART+G[G_SUBSCREENAREA]] >= 10){ Screen->DrawString(6, SUB_COUNTERSX+42, SUB_COUNTERSY+10, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); Screen->DrawInteger(6, SUB_COUNTERSX+47, SUB_COUNTERSY+10, FONT_Z3SMALL,0x01, 0x00,-1, -1, GetAreaItemTotal(G[G_SUBSCREENAREA]), 0, OP_OPAQUE); } else{ Screen->DrawString(6, SUB_COUNTERSX+37, SUB_COUNTERSY+10, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); Screen->DrawInteger(6, SUB_COUNTERSX+42, SUB_COUNTERSY+10, FONT_Z3SMALL,0x01, 0x00,-1, -1, GetAreaItemTotal(G[G_SUBSCREENAREA]), 0, OP_OPAQUE); } } itemdata itemdata1 = Game->LoadItemData(ItemIDs[GetItemIndex(Positions, position)]); //Item Name int Itemname[50]; itemdata1->GetName(Itemname); Screen->DrawString(6, ItemStart, ItemboxBottom+4, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Itemname, OP_OPAQUE); bool SwordObtained; int sworditem = ItemIDs[0]; if(Link->Item[sworditem]) SwordObtained = true; if(SwordObtained){ int PosX = ItemStart+(position%SUB_ITEMCOLUMNS)*20; //Draw Selector int PosY = SUB_MAINBOX_Y+SUB_ITEMBOX_Y+2+Floor(position/SUB_ITEMCOLUMNS)*20; Screen->FastCombo(6, PosX, PosY, CMB_SUBSELECTOR, 11, OP_OPAQUE); } else{ Link->PressA = false; Link->PressB = false; Link->PressL = false; Link->PressR = false; Link->PressUp = false; Link->PressDown = false; Link->PressLeft = false; Link->PressRight = false; } if(Link->PressLeft){ //Selector control for changing position for(int i = 0; i < 50; i++){ position --; if(position < 0) position += NumPositions; int item1 = ItemIDs[GetItemIndex(Positions, position)]; if(Link->Item[item1] && position >= 0 && position <= NumPositions-1){ G[G_SUBPOSITION] = position; break; } } Game->PlaySound(5); } if(Link->PressRight){ for(int i = 0; i < 50; i++){ position ++; if(position > NumPositions-1) position -= NumPositions; int item1 = ItemIDs[GetItemIndex(Positions, position)]; if(Link->Item[item1] && position >= 0 && position <= NumPositions-1){ G[G_SUBPOSITION] = position; break; } } Game->PlaySound(5); } if(Link->PressUp){ for(int i = 0; i < 50; i++){ position -= SUB_ITEMCOLUMNS; if(position < 0) position += SUB_ITEMCOLUMNS*ItemboxHeight/20; int item1 = ItemIDs[GetItemIndex(Positions, position)]; if(Link->Item[item1] && position >= 0 && position <= NumPositions-1){ G[G_SUBPOSITION] = position; break; } } Game->PlaySound(5); } if(Link->PressDown){ for(int i = 0; i < 50; i++){ position += SUB_ITEMCOLUMNS; if(position > NumPositions-1) position -= SUB_ITEMCOLUMNS*ItemboxHeight/20; int item1 = ItemIDs[GetItemIndex(Positions, position)]; if(Link->Item[item1] && position >= 0 && position <= NumPositions-1){ G[G_SUBPOSITION] = position; break; } } Game->PlaySound(5); } int positionitem = ItemIDs[GetItemIndex(Positions, position)]; if(Link->PressB){ //Equip items now Link->InputA = false; Link->PressA = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; int item1 = ItemIDs[GetItemIndex(Positions, position)]; int AItem = G[G_LINK_EQUIPA]; int BItem = G[G_LINK_EQUIPB]; int LItem = G[G_LINK_EQUIPL]; int RItem = G[G_LINK_EQUIPR]; //Null button that has item currently if(LItem == item1){ //If L, A, or R held the item B just selected, gotta set them to something else G[G_LINK_EQUIPL] = -1; } if(AItem == item1){ G[G_LINK_EQUIPA] = -1; } if(RItem == item1) G[G_LINK_EQUIPR] = -1; //Set item to button G[G_LINK_EQUIPB] = item1; //Now set L to that item //Give old item to button that was nulled if(G[G_LINK_EQUIPL] == -1){//Now if A, L, or R got moved away, give them the item B had before G[G_LINK_EQUIPL] = BItem; } if(G[G_LINK_EQUIPA] == -1){ G[G_LINK_EQUIPA] = BItem; } if(G[G_LINK_EQUIPR] == -1) G[G_LINK_EQUIPR] = BItem; Game->PlaySound(21); } else if(Link->PressA){ Link->InputB = false; Link->PressB = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; int item1 = ItemIDs[GetItemIndex(Positions, position)]; int AItem = G[G_LINK_EQUIPA]; int BItem = G[G_LINK_EQUIPB]; int LItem = G[G_LINK_EQUIPL]; int RItem = G[G_LINK_EQUIPR]; //Null button that has item currently if(LItem == item1){ //If L, B, or R held the item A just selected, gotta set them to something else G[G_LINK_EQUIPL] = -1; } if(BItem == item1){ G[G_LINK_EQUIPB] = -1; } if(RItem == item1) G[G_LINK_EQUIPR] = -1; //Set item to button G[G_LINK_EQUIPA] = item1; //Now set L to that item //Give old item to button that was nulled if(G[G_LINK_EQUIPB] == -1){//Now if L, B, or R got moved away, give them the item A had before G[G_LINK_EQUIPB] = AItem; } if(G[G_LINK_EQUIPL] == -1){ G[G_LINK_EQUIPL] = AItem; } if(G[G_LINK_EQUIPR] == -1) G[G_LINK_EQUIPR] = AItem; Game->PlaySound(21); } else if(Link->PressL){ Link->InputA = false; Link->PressA = false; Link->InputB = false; Link->PressB = false; Link->InputR = false; Link->PressR = false; int item1 = ItemIDs[GetItemIndex(Positions, position)]; int AItem = G[G_LINK_EQUIPA]; int BItem = G[G_LINK_EQUIPB]; int LItem = G[G_LINK_EQUIPL]; int RItem = G[G_LINK_EQUIPR]; //Null button that has item currently if(AItem == item1){ //If A, B, or R held the item L just selected, gotta set them to something else G[G_LINK_EQUIPA] = -1; } if(BItem == item1){ G[G_LINK_EQUIPB] = -1; } if(RItem == item1) G[G_LINK_EQUIPR] = -1; //Set item to button G[G_LINK_EQUIPL] = item1; //Now set L to that item //Give old item to button that was nulled if(G[G_LINK_EQUIPB] == -1){//Now if A, B, or R got moved away, give them the item L had before G[G_LINK_EQUIPB] = LItem; } if(G[G_LINK_EQUIPA] == -1){ G[G_LINK_EQUIPA] = LItem; } if(G[G_LINK_EQUIPR] == -1) G[G_LINK_EQUIPR] = LItem; Game->PlaySound(21); } else if(Link->PressR){ Link->InputA = false; Link->PressA = false; Link->InputL = false; Link->PressL = false; Link->InputB = false; Link->PressB = false; int item1 = ItemIDs[GetItemIndex(Positions, position)]; int AItem = G[G_LINK_EQUIPA]; int BItem = G[G_LINK_EQUIPB]; int LItem = G[G_LINK_EQUIPL]; int RItem = G[G_LINK_EQUIPR]; //Null button that has item currently if(AItem == item1){ //If A, B, or L held the item L just selected, gotta set them to something else G[G_LINK_EQUIPA] = -1; } if(BItem == item1){ G[G_LINK_EQUIPB] = -1; } if(LItem == item1) G[G_LINK_EQUIPL] = -1; //Set item to button G[G_LINK_EQUIPR] = item1; //Now set R to that item //Give old item to button that was nulled if(G[G_LINK_EQUIPB] == -1){//Now if A, B, or L got moved away, give them the item R had before G[G_LINK_EQUIPB] = RItem; } if(G[G_LINK_EQUIPA] == -1){ G[G_LINK_EQUIPA] = RItem; } if(G[G_LINK_EQUIPL] == -1) G[G_LINK_EQUIPL] = RItem; Game->PlaySound(21); } CharacterShift(); KillDirInput(); } } void KillDirInput(){ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputR = false; Link->InputL = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; } void SetEquipmentA(int item1){ for(int i = 0; i < 50; i ++){ if(GetEquipmentA() == item1) break; else Link->SelectAWeapon(DIR_RIGHT); } if(GetEquipmentA() != item1){ for(int i = 0; i < 50; i ++){ if(GetEquipmentA() == ITM_NULL) break; else Link->SelectAWeapon(DIR_RIGHT); } } } const int ITM_NULL = 201; const int ITM_NULLB = 202; void SetEquipmentB(int item1){ for(int i = 0; i < 50; i ++){ if(GetEquipmentB() == item1) break; else Link->SelectBWeapon(DIR_RIGHT); } return; if(GetEquipmentB() != item1){ for(int i = 0; i < 50; i ++){ if(GetEquipmentB() == ITM_NULLB) break; else Link->SelectBWeapon(DIR_RIGHT); } } } bool CanUseWeapon(int id){ if(Link->SwordJinx != 0) return false; if(NumLWeaponsOf(LW_HOOKSHOT) >0) return false; if(SubscreenOpen()) return false; if(Link->Action == LA_SWIMMING || Link->Action == LA_DIVING) return false; if(G[G_NOITEMS] > 0) return false; if((id == 3 || id == 177) && Game->Counter[CR_BOMBS] <= 0){ bool breakflag; for(int i = Screen->NumLWeapons(); i>0; i--){ lweapon l = Screen->LoadLWeapon(i); if(l->ID == LW_BOMB){ breakflag = true; break; } } if(!breakflag) return false; } return true; } void UseButtonItem(int id){ if(Link->Item[id]){ if(G[G_LINK_EQUIPA] == id || G[G_LINK_EQUIPL] == id){ SetEquipmentA(id); Link->PressA = true; Link->InputA = true; } else if(G[G_LINK_EQUIPB] == id || G[G_LINK_EQUIPR] == id){ SetEquipmentB(id); Link->PressB = true; Link->InputB = true; } } } void ActivateWeapon(){ int id; if(Link->PressA) id = G[G_LINK_EQUIPA]; else if(Link->PressB) id = G[G_LINK_EQUIPB]; else if(Link->PressL) id = G[G_LINK_EQUIPL]; else if(Link->PressR) id = G[G_LINK_EQUIPR]; if(id != 0 && CanUseWeapon(id)){ itemdata weapondata = Game->LoadItemData(id); if(weapondata->InitD[7] == 0) UseButtonItem(id); else{ int Args[8]; for(int i = 0; i < 8; i++){ Args[i] = weapondata->InitD[i]; } if(CountFFCsRunning(weapondata->InitD[7]) == 0) RunFFCScript(weapondata->InitD[7], Args); } } } bool InputWeapon(int weapon){ if(Link->InputA && G[G_LINK_EQUIPA] == weapon) return true; else if(Link->InputB && G[G_LINK_EQUIPB] == weapon) return true; else if(Link->InputL && G[G_LINK_EQUIPL] == weapon) return true; else if(Link->InputR && G[G_LINK_EQUIPR] == weapon) return true; else return false; } bool PressWeapon(int weapon){ if(Link->PressA && G[G_LINK_EQUIPA] == weapon) return true; else if(Link->PressB && G[G_LINK_EQUIPB] == weapon) return true; else if(Link->PressL && G[G_LINK_EQUIPL] == weapon) return true; else if(Link->PressR && G[G_LINK_EQUIPR] == weapon) return true; else return false; } const int BUTTONFRAMES_X = 126; //Coordinate for the upper left of the first item const int BUTTONFRAMES_Y = -46; const int TIL_BUTTON_FRAME = 53308; //The frame graphic for the items. -1 draws a simple box around each item. 0 is no frame. const int BUTTON_FRAMECSET = 7; //CSet for the button frame graphic const int BUTTON_FRAMEWIDTH = 20; //Width of graphic in pixels. This assumes a square-ish frame anchored in the top left of a tile block. const int BUTTON_SPACING = 8; //The spacing between button items. Remember to leave space for the frames! const int BUTTON_BLOCKSTYLE = 0; //Arrangement for the block of button items. 0 = 2x2 block, 1 = 1x4 block void DrawButtonItems(){ int i; int NumItems = SizeOfArray(ItemIDs); int AX; int AY; int BX; int BY; int LX; int LY; int RX; int RY; int A[] = "A"; int B[] = "B"; int L[] = "L"; int R[] = "R"; if(BUTTON_BLOCKSTYLE == 1){ AX = BUTTONFRAMES_X; AY = BUTTONFRAMES_Y; BX = AX+16+BUTTON_SPACING; BY = BUTTONFRAMES_Y; LX = BX+16+BUTTON_SPACING; LY = BUTTONFRAMES_Y; RX = LX+16+BUTTON_SPACING; RY = BUTTONFRAMES_Y; } else{ LX = BUTTONFRAMES_X; LY = BUTTONFRAMES_Y; RX = LX+16+BUTTON_SPACING; RY = BUTTONFRAMES_Y; BX = LX; BY = LY+16+BUTTON_SPACING; AX = RX; AY = RY+16+BUTTON_SPACING; } for(i = 0; i < NumItems; i++){ //Scroll through all items if(ItemIDs[i] == G[G_LINK_EQUIPA]){ Screen->FastTile(7, AX, AY, ItemTiles[i], ItemCSets[i], OP_OPAQUE); break; } } for(i = 0; i < NumItems; i++){ //Scroll through all items if(ItemIDs[i] == G[G_LINK_EQUIPB]){ Screen->FastTile(7, BX, BY, ItemTiles[i], ItemCSets[i], OP_OPAQUE); break; } } for(i = 0; i < NumItems; i++){ //Scroll through all items if(ItemIDs[i] == G[G_LINK_EQUIPL]){ Screen->FastTile(7, LX, LY, ItemTiles[i], ItemCSets[i], OP_OPAQUE); break; } } for(i = 0; i < NumItems; i++){ //Scroll through all items if(ItemIDs[i] == G[G_LINK_EQUIPR]){ Screen->FastTile(7, RX, RY, ItemTiles[i], ItemCSets[i], OP_OPAQUE); break; } } int frameoffset = Ceiling((BUTTON_FRAMEWIDTH-16)/2); if(TIL_BUTTON_FRAME != 0){ int framex; int framey; for(int i = 0; i < 4; i++){ if(BUTTON_BLOCKSTYLE == 1){ framex = BUTTONFRAMES_X+i*(16+BUTTON_SPACING)-frameoffset; framey = BUTTONFRAMES_Y-frameoffset; } else{ framex = BUTTONFRAMES_X+(i%2)*(16+BUTTON_SPACING)-frameoffset; framey = BUTTONFRAMES_Y+Floor(i/2)*(16+BUTTON_SPACING)-frameoffset; } if(TIL_BUTTON_FRAME == -1) Screen->Rectangle(7, framex, framey, framex+BUTTON_FRAMEWIDTH, framey+BUTTON_FRAMEWIDTH, SUB_COLOR, 1, 0, 0, 0, false, OP_OPAQUE); else Screen->DrawTile(7, framex, framey, TIL_BUTTON_FRAME, Ceiling(BUTTON_FRAMEWIDTH/16), Ceiling(BUTTON_FRAMEWIDTH/16), BUTTON_FRAMECSET, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); int buttonname; } } Screen->DrawString(7, AX+6, AY-frameoffset-4, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, A, OP_OPAQUE); Screen->DrawString(7, BX+6, BY-frameoffset-4, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, B, OP_OPAQUE); Screen->DrawString(7, LX+6, LY-frameoffset-4, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, L, OP_OPAQUE); Screen->DrawString(7, RX+6, RY-frameoffset-4, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, R, OP_OPAQUE); } const int SPR_EXPLODINGJELLY_PUFF = 128; ffc script ExplodingJelly{ void run(int enemyid){ this->Flags[FFCF_IGNOREHOLDUP] = true; int i; int j; int k; npc ghost = Ghost_InitAutoGhost(this, enemyid); int vars[16] = {0}; ghost->DrawYOffset = -1000; int vX = Choose(-1, 1)*Rand(25, 100)*0.01*0.3; int vY = Choose(-1, 1)*Rand(25, 100)*0.01*0.3; int startX = Ghost_X; int startY = Ghost_Y; int Chase = ghost->Attributes[9]; while(vars[0]==0){ if(!ghost->isValid()) Quit(); vX = Clamp(vX+Sign(startX-Ghost_X)*0.005, -0.3, 0.3); vY = Clamp(vY+Sign(startY-Ghost_Y)*0.005, -0.3, 0.3); Ghost_X += vX; Ghost_Y += vY; if(Chase == 1){ startX = Link->X + 8; startY = Link->Y + 8; } EJ_Waitframe(this, ghost, vars); } if(!ghost->isValid()) Quit(); i = Angle(Link->X, Link->Y, Ghost_X, Ghost_Y); vX = VectorX(2, i); vY = VectorY(2, i); int maxV = 2; int accel = 0.05; startX = Ghost_X; startY = Ghost_Y; int puffTimer = 8; Ghost_SetHitOffsets(ghost, 4, 4, 4, 4); while(true){ if(!ghost->isValid()) Quit(); if(puffTimer>0){ puffTimer--; for(i=0; i<3; i++){ lweapon poof = CreateLWeaponAt(LW_SPARKLE, startX, startY); poof->CollDetection = false; poof->UseSprite(SPR_EXPLODINGJELLY_PUFF); poof->Angular = true; poof->Angle = DegtoRad(Rand(360)); poof->Step = Rand(50, 200); } } vX = Clamp(vX+Sign(Link->X-Ghost_X)*accel, -maxV, maxV); vY = Clamp(vY+Sign(Link->Y-Ghost_Y)*accel, -maxV, maxV); maxV += 0.01; accel += 0.001; Ghost_MoveXYPit(vX, vY, 0); int dir = AngleDir4(Angle(0, 0, vX, vY)); if(puffTimer<=0){ // if(Distance(0, 0, vX, vY)>=1&&!Ghost_CanMove(dir, 1, 0)) if(Distance(0, 0, vX, vY)>=1&&!CanWalkPit(Ghost_X, Ghost_Y, dir, 1, 0)) break; if(LinkCollision(ghost)) break; if(Chase == 1){ npc Curse = Screen->LoadNPC(1); if(Collision(ghost, Curse)) break; } // if((vX<=-1&&!Ghost_CanMove(DIR_LEFT, 1, 0)) || (vX>=1&&!Ghost_CanMove(DIR_RIGHT, 1, 0))){ // break; // } // if((vY<=-1&&!Ghost_CanMove(DIR_UP, 1, 0)) || (vY>=1&&!Ghost_CanMove(DIR_DOWN, 1, 0))){ // break; // } } EJ_Waitframe(this, ghost, vars); } int damage = ghost->WeaponDamage; startX = Ghost_X; startY = Ghost_Y; ghost->ItemSet = 0; ghost->DrawYOffset = -1000; ghost->HP = -1000; Game->GuyCount[Game->GetCurScreen()]++; for(i=0; i<4; i++){ eweapon e = FireEWeapon(EW_SBOMBBLAST, startX+Rand(-8, 8), startY+Rand(-8, 8), 0, 0, damage, -1, -1, 0); if(Chase == 1) e->Misc[0] = 1; Waitframes(4); } Quit(); } void EJ_Draw(ffc this, npc ghost, int vars){ int combo = ghost->Attributes[10]; int Over = ghost->Attributes[9]; int layer = 2; if(Over == 1) layer = 4; int cs; if(Link->HP>0){ if(vars[0]==0){ cs = 8; if(__Ghost_FlashCounter>0) cs = this->CSet; Screen->FastCombo(layer, Ghost_X, Ghost_Y-2, combo+1, cs, 128); Screen->FastCombo(layer, Ghost_X, Ghost_Y-2+12, combo+3, this->CSet, 128); Screen->FastCombo(layer, Ghost_X, Ghost_Y-2, combo, this->CSet, 128); } else{ cs = 8; if(__Ghost_FlashCounter>0) cs = this->CSet; Screen->FastCombo(layer, Ghost_X, Ghost_Y-2, combo+2, cs, 128); } } } void EJ_Waitframe(ffc this, npc ghost, int vars){ EJ_Draw(this, ghost, vars); if(!Ghost_Waitframe(this, ghost, true, false)){ if(!ghost->isValid()) Quit(); Ghost_HP = 1000; ghost->HP = 1000; ghost->CollDetection = false; vars[0] = 1; } } } ffc script Torch{ void run(int function, int which){ if(function == 0){ //The Torch if(G[G_TORCH + which] == 1){ this->Data += 1; Quit(); } while(true){ for(int i = 1; i<=Screen->NumLWeapons(); i++){ lweapon l = Screen->LoadLWeapon(i); if((l->ID == LW_FIRE || l->ID == LW_BEAM) && Collision (this, l)){ Game->PlaySound(27); Game->PlaySound(39); this->Data++; G[G_TORCH + which] = 1; Quit(); } } Waitframe(); } } else{ //The Platform while(G[G_TORCH + which] == 0){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 98+which) Screen->FastCombo(2, ComboX(i), ComboY(i), 4268 + which, 0, OP_OPAQUE); } Waitframe(); } for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 98+which){ Screen->ComboD[i] = 4232+which; SetLayerComboD(1, i, 0); } } } } } bool CanWalkPit(int x, int y, int dir, int step, bool full_tile) { int c=8; int xx = x+15; int yy = y+15; if(full_tile) c=0; if(dir==0) return !(y-step<0 || (Screen->isSolid(x,y+c-step) && Screen->ComboT[ComboAt(x,y+c-step)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(x+8,y+c-step) && Screen->ComboT[ComboAt(x+8,y+c-step)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(xx,y+c-step) && Screen->ComboT[ComboAt(xx,y+c-step)] != CT_LADDERHOOKSHOT)); else if(dir==1) return !(yy+step>=176 || (Screen->isSolid(x,yy+step) && Screen->ComboT[ComboAt(x,yy+step)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(x+8,yy+step) && Screen->ComboT[ComboAt(x+8,yy+step)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(xx,yy+step) && Screen->ComboT[ComboAt(xx,yy+step)] != CT_LADDERHOOKSHOT)); else if(dir==2) return !(x-step<0 || (Screen->isSolid(x-step,y+c) && Screen->ComboT[ComboAt(x-step,y+c)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(x-step,y+c+7) && Screen->ComboT[ComboAt(x-step,y+c+7)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(x-step,yy) && Screen->ComboT[ComboAt(x-step,yy)] != CT_LADDERHOOKSHOT)); else if(dir==3) return !(xx+step>=256 || (Screen->isSolid(xx+step,y+c) && Screen->ComboT[ComboAt(xx+step,y+c)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(xx+step,y+c+7) && Screen->ComboT[ComboAt(xx+step,y+c+7)] != CT_LADDERHOOKSHOT) || (Screen->isSolid(xx+step,yy) && Screen->ComboT[ComboAt(xx+step,yy)] != CT_LADDERHOOKSHOT)); return false; //invalid direction } void Ghost_MoveXYPit(float xStep, float yStep, int imprecision) { // If this is sideview, most enemies can't move upward if(yStep<0 && IsSideview() && !Ghost_FlagIsSet(GHF_NO_FALL)) yStep=0; // If moving more than 8 pixels along either axis, go 8 at a time while(Abs(xStep)>8 || Abs(yStep)>8) { if(Abs(xStep)>=Abs(yStep)) { if(xStep>0) { Ghost_MoveXY(8, 0, imprecision); xStep-=8; } else { Ghost_MoveXY(-8, 0, imprecision); xStep+=8; } } else // yStep>=xStep { if(yStep>0) { Ghost_MoveXY(0, 8, imprecision); yStep-=8; } else { Ghost_MoveXY(0, -8, imprecision); yStep+=8; } } } int edge; // Position of leading edge int edgeDiff; // Difference between Ghost_X/Ghost_Y and edge int startHT; // The half-tile position where the edge starts int endHT; // And where it ends up if(xStep<0) // Left { edgeDiff=__Ghost_XOffsets>>8; edge=Ghost_X+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+xStep)/8); // If the edge ends up on the same half-tile line it's already on, // there's no need to check walkability if(startHT==endHT) edge+=xStep; else if(CanWalkPit(Ghost_X, Ghost_Y, DIR_LEFT, -xStep, imprecision)) edge+=xStep; else // Can't move all the way; snap to the grid edge=(edge>>3)<<3; Ghost_X=edge-edgeDiff; } else if(xStep>0) // Right { edgeDiff=16*Ghost_TileWidth-(__Ghost_XOffsets&0xFF)-1; edge=Ghost_X+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+xStep)/8); if(startHT==endHT) edge+=xStep; else if(CanWalkPit(Ghost_X, Ghost_Y, DIR_RIGHT, xStep, imprecision)) edge+=xStep; else edge=(((edge+7)>>3)<<3)-1; Ghost_X=edge-edgeDiff; } if(yStep<0) // Up { edgeDiff=__Ghost_YOffsets>>8; edge=Ghost_Y+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+yStep)/8); // If the edge ends up on the same half-tile line it's already on, // there's no need to check walkability if(startHT==endHT) edge+=yStep; else if(CanWalkPit(Ghost_X, Ghost_Y, DIR_UP, -yStep, imprecision)) edge+=yStep; else // Can't move all the way; snap to the grid edge=(edge>>3)<<3; Ghost_Y=edge-edgeDiff; } else if(yStep>0) // Down { edgeDiff=16*Ghost_TileHeight-(__Ghost_YOffsets&0xFF)-1; edge=Ghost_Y+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+yStep)/8); if(startHT==endHT) edge+=yStep; else if(CanWalkPit(Ghost_X, Ghost_Y, DIR_DOWN, yStep, imprecision)) edge+=yStep; else edge=(((edge+7)>>3)<<3)-1; Ghost_Y=edge-edgeDiff; } if(Ghost_FlagIsSet(GHF_SET_DIRECTION) && (__Ghost_InternalFlags&__GHFI_DIR_FORCED)==0) { // Use 8 directions if 8-way flag is set if(Ghost_FlagIsSet(GHF_8WAY)) Ghost_Dir=AngleDir8(WrapAngle(ArcTan(xStep, yStep))*57.2958); // Otherwise, 4 directions else { if(Abs(xStep)LItems[Game->GetCurLevel()] = LI_COMPASS ; } } const int ITEM_LADDER = 27; const int RT_BRIDGE = 0; const int RT_ITEMPOPUP = 1; int IHateZC[352]; ffc script MagicLadder{ void run(){ this->Flags[FFCF_IGNOREHOLDUP] = true; for(int i = 0; i<352; i++) IHateZC[i] = 0; Screen->SetRenderTarget(RT_BRIDGE); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap Screen->SetRenderTarget(RT_SCREEN); int BridgeCombo = 4243; int Layer0[176]; int Layer1[176]; int Layer2[176]; int LinkX = GridX(Link->X + 8); int LinkY = GridY(Link->Y + 8); int Dir = Link->Dir; int BridgeTile = 22942; if(Dir == DIR_LEFT || Dir == DIR_RIGHT){ BridgeTile = 22943; } int StartX = LinkX + RussInFrontX(Link->Dir, 0); int StartY = LinkY + RussInFrontY(Link->Dir, 0); if(Offscreen(StartX, StartY)){ Game->PlaySound(60); Quit(); } if(((StartX == 0 || StartX == 240) && (Link->Dir == DIR_UP || Link->Dir == DIR_DOWN)) || ((StartY == 0 || StartY == 160) && (Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT))){ Game->PlaySound(60); Quit(); } int CrossingType; if(Screen->ComboT[ComboAt(StartX, StartY)] == CT_LADDERHOOKSHOT) CrossingType = 0; //Pit else if(Screen->ComboS[ComboAt(StartX, StartY)] != 0 || GetLayerComboS(1, ComboAt(StartX, StartY)) != 0 || GetLayerComboS(2, ComboAt(StartX, StartY)) != 0){ CrossingType = 2; //Wall Quit(); } else CrossingType = 1; //Floor int CurrentCombo = ComboAt(StartX, StartY); bool breakflag; if(CurrentCombo < 0 || CurrentCombo > 175){ Game->PlaySound(60); Quit(); } bool stopflag; G[G_BRIDGEIDENTIFIER] = Game->GetCurMap() + Game->GetCurScreen(); if(Game->GetCurDMap() == 27 && Screen->ComboT[CurrentCombo] == CT_LADDERHOOKSHOT){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, ComboX(CurrentCombo), ComboY(CurrentCombo)); l->UseSprite(137); l->DeadState = l->NumFrames*l->ASpeed; lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, ComboX(CurrentCombo), ComboY(CurrentCombo)); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; breakflag = true; } Waitframe(); while(true){ if(!breakflag){ Layer0[CurrentCombo] = Screen->ComboD[CurrentCombo]; Layer1[CurrentCombo] = GetLayerComboD(1,CurrentCombo); IHateZC[CurrentCombo] = GetLayerComboD(1,CurrentCombo); Layer2[CurrentCombo] = GetLayerComboD(2,CurrentCombo); IHateZC[CurrentCombo + 176] = GetLayerComboD(2,CurrentCombo); G[G_BRIDGEMAP1] = Screen->LayerMap(1); G[G_BRIDGESCREEN1] = Screen->LayerScreen(1); G[G_BRIDGEMAP2] = Screen->LayerMap(2); G[G_BRIDGESCREEN2] = Screen->LayerScreen(2); Screen->SetRenderTarget(RT_BRIDGE); Screen->FastCombo(0, ComboX(CurrentCombo), ComboY(CurrentCombo), Screen->ComboD[CurrentCombo], Screen->ComboC[CurrentCombo], OP_OPAQUE); Screen->FastCombo(0, ComboX(CurrentCombo), ComboY(CurrentCombo), GetLayerComboD(1,CurrentCombo), GetLayerComboC(1,CurrentCombo), OP_OPAQUE); Screen->FastCombo(0, ComboX(CurrentCombo), ComboY(CurrentCombo), GetLayerComboD(2,CurrentCombo), GetLayerComboC(2,CurrentCombo), OP_OPAQUE); Screen->FastTile(0, ComboX(CurrentCombo), ComboY(CurrentCombo), BridgeTile, 8, OP_OPAQUE); Screen->SetRenderTarget(RT_SCREEN); Bridge_Waitframe(this, Layer0, Layer1, Layer2); SetLayerComboD(1, CurrentCombo, 0); SetLayerComboD(2, CurrentCombo, 0); SetLayerComboD(0, CurrentCombo, BridgeCombo+1); lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, ComboX(CurrentCombo), ComboY(CurrentCombo)); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; Game->PlaySound(16); if(Dir == DIR_UP){ if(CurrentCombo < 16) breakflag = true; CurrentCombo -= 16; } else if(Dir == DIR_DOWN){ if(CurrentCombo >= 160) breakflag = true; CurrentCombo +=16; } else if(Dir == DIR_LEFT){ if(ComboX(CurrentCombo) == 0) breakflag = true; CurrentCombo --; } else{ if(ComboX(CurrentCombo) == 240) breakflag = true; CurrentCombo++; } if(CurrentCombo < 0 || CurrentCombo > 175) breakflag = true; if(!breakflag){ if(Game->GetCurDMap() == 27 && Screen->ComboT[CurrentCombo] == CT_LADDERHOOKSHOT){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, ComboX(CurrentCombo), ComboY(CurrentCombo)); l->UseSprite(137); l->DeadState = l->NumFrames*l->ASpeed; breakflag = true; } } } if(breakflag){ RestoreCombos(Layer0, Layer1, Layer2); Quit(); } if((Screen->ComboS[CurrentCombo] != 0 && Screen->ComboT[CurrentCombo] != CT_LADDERHOOKSHOT) || (GetLayerComboS(1, CurrentCombo) != 0 && GetLayerComboT(1, CurrentCombo) != CT_LADDERHOOKSHOT) || (GetLayerComboS(2, CurrentCombo) != 0 && GetLayerComboT(2, CurrentCombo) != CT_LADDERHOOKSHOT)) //Hit a wall stopflag = true; else if((Screen->ComboS[CurrentCombo] != 0 && Screen->ComboT[CurrentCombo] == CT_LADDERHOOKSHOT) && !(GetLayerComboS(1, CurrentCombo) != 0 && GetLayerComboT(1, CurrentCombo) != CT_LADDERHOOKSHOT) && !(GetLayerComboS(2, CurrentCombo) != 0 && GetLayerComboT(2, CurrentCombo) != CT_LADDERHOOKSHOT)){ //Hit a pit if(CrossingType == 1) CrossingType = 0; } else if(Screen->ComboS[CurrentCombo] == 0 && GetLayerComboS(1, CurrentCombo) == 0 && GetLayerComboS(2, CurrentCombo) == 0 && CrossingType == 0){ //Hit land stopflag = true; } if(stopflag == true && Game->GetCurMap() == 2 && Game->GetCurScreen() == 0x35 && GetLayerComboT(1, CurrentCombo) == CT_LOCKBLOCK2 && Screen->State[ST_LOCKBLOCK] == false) //Yay for hardcoding exceptions stopflag = false; Bridge_Waitframes(this, Layer0, Layer1, Layer2, 5); if(stopflag){ for(int i = 0; i<176; i++){ if(Screen->ComboD[i] == BridgeCombo+1) Screen->ComboD[i]--; } while(true){ if(PressWeapon(ITEM_LADDER) && Screen->ComboD[ComboAt(Link->X+8, Link->Y+8)] != BridgeCombo && G[G_NOITEMS] == 0){ breakflag = false; stopflag = false; LinkX = GridX(Link->X+8); LinkY = GridY(Link->Y+8); Dir = Link->Dir; StartX = LinkX + RussInFrontX(Link->Dir, 0); StartY = LinkY + RussInFrontY(Link->Dir, 0); BridgeTile = 22942; if(Dir == DIR_LEFT || Dir == DIR_RIGHT){ BridgeTile = 22943; } if(((StartX == 0 || StartX == 240) && (Link->Dir == DIR_UP || Link->Dir == DIR_DOWN)) || ((StartY == 0 || StartY == 160) && (Link->Dir == DIR_LEFT || Link->Dir == DIR_RIGHT))){ CrossingType = 2; //Wall RestoreCombos(Layer0, Layer1, Layer2); Game->PlaySound(60); Quit(); } else if(Screen->ComboT[ComboAt(StartX, StartY)] == CT_LADDERHOOKSHOT) CrossingType = 0; //Pit else if(Screen->ComboS[ComboAt(StartX, StartY)] != 0 || GetLayerComboS(1, ComboAt(StartX, StartY)) != 0 || GetLayerComboS(2, ComboAt(StartX, StartY)) != 0){ CrossingType = 2; //Wall RestoreCombos(Layer0, Layer1, Layer2); Quit(); } else CrossingType = 1; //Floor CurrentCombo = ComboAt(StartX, StartY); RestoreCombos(Layer0, Layer1, Layer2); break; } Bridge_Waitframe(this, Layer0, Layer1, Layer2); } } Bridge_Waitframe(this, Layer0, Layer1, Layer2); } } void RestoreCombos(int Layer0, int Layer1, int Layer2){ for(int i = 0; i<176; i++){ if(Layer0[i] > 0){ SetLayerComboD(1, i, Layer1[i]); SetLayerComboD(2, i, Layer2[i]); SetLayerComboD(0, i, Layer0[i]); lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, ComboX(i), ComboY(i)); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; Game->PlaySound(60); Layer0[i] = 0; Layer1[i] = 0; Layer2[i] = 0; for(int j = Screen->NumNPCs(); j > 0; j--){ npc n = Screen->LoadNPC(j); if(!Offscreen(n->X, n->Y)){ if(Distance(n->X, n->Y, ComboX(i), ComboY(i)) <= 8){ if(Screen->ComboT[i] == CT_LADDERHOOKSHOT && !FlyingEnemy(n) && n->Misc[0] != 1000){ lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, ComboX(i), ComboY(i)); spawn->UseSprite(139); // spawn->Misc[CLW_TIMER] = 12; spawn->DeadState = spawn->NumFrames*spawn->ASpeed; spawn->CSet = n->CSet; spawn->CollDetection = false; Game->PlaySound(38); n->Misc[0] = 1000; n->Y = -1000; n->HP = 0; } } } } Screen->SetRenderTarget(RT_BRIDGE); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap Screen->SetRenderTarget(RT_SCREEN); } } } void Bridge_Waitframe(ffc this, int Layer0, int Layer1, int Layer2){ Screen->DrawBitmap (1, RT_BRIDGE, 0, 0, 248, 168, 0, 0, 248, 168, 0, true); if(this->Misc[0] == 1) RestoreCombos(Layer0, Layer1, Layer2); Waitframe(); } void Bridge_Waitframes(ffc this, int Layer0, int Layer1, int Layer2, int frames){ for(int i = 0; iType == NPCT_PEAHAT || n->Type == NPCT_KEESE || n->Type == NPCT_WIZZROBE || n->Type == NPCT_PATRA || n->Type == NPCT_OTHERFLOAT || n->ID == 285 //Greedlet L2 || n->ID == 287 //Bone Fish Fire || n->ID == 270 //Pit Fish || n->ID == 277 //Boo || n->ID == 283 //Super Lynel || n->ID == 261 //FireRobe || n->ID == 264 //PierceRobe || n->ID == 207 //Fire2Robe || n->ID == 188 //Aquamentus boss || n->ID == 194 //Timerobe || n->ID == 200 //Windrobe || n->ID == 236 //Curserobe || n->ID == 237 //Floating Curserobe || n->ID == 238 //Floating Timerobe || n->ID == 276 //Exploding Jelly || n->ID == 241 //Exploding Jelly 2 || n->ID == 242 //Exploding Jelly Chase 2 || n->ID == 301 //DigDog baby || n->ID == 302 //DigDog 2 || n->ID == 303 //DigDog 3 || n->ID == 286 //Roadblock ) return true; else return false; } ffc script BooRing{ void run(int radius, int speed, int damage, int number, int holes, int combo, int numcombos, int dickmove){ if(numcombos == 6) numcombos = 3; int angle; int BooX[20]; int BooY[20]; int BooAngleOffset[20]; int BooValid[20]; int BooCombo[20]; for(int i = 0; i<20; i++){ if(i>=number){ BooX[i] = -1; BooY[i] = -1; BooAngleOffset[i] = -1; BooValid[i] = 0; } else{ angle+=360/number; BooAngleOffset[i] = angle; BooValid[i] = 1; BooCombo[i] = combo + Rand(0, numcombos); } } for(int i = 0; i<=holes&&holes!=0; i++){ int index = Floor((i)/holes * number); BooX[index] = -1; BooY[index] = -1; BooAngleOffset[index] = -1; BooValid[index] = 0; } angle = 0; int Thex; int They; int otherangle; int dist = 48; while(true){ angle+=speed; if(angle >= 360) angle-=360; for(int i = 0; i<20; i++){ if(BooValid[i] == 1){ BooX[i] = this->X + VectorX(radius, BooAngleOffset[i] + angle); BooY[i] = this->Y + VectorY(radius, BooAngleOffset[i] + angle); Screen->FastCombo(2, BooX[i], BooY[i], BooCombo[i], 7, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 6, BooX[i]+8, BooY[i]+8, 8)) DamageLink(damage); } } if(dickmove == 1){ Thex = Link->X + VectorX(dist, otherangle); They = Link->Y + VectorY(dist, otherangle); this->Vx = Clamp(this->Vx+Sign(Thex-this->X+8)*0.1, -1, 1); this->Vy = Clamp(this->Vy+Sign(They-this->Y+8)*0.1, -1, 1); otherangle+=5; } Waitframe(); } } } ffc script AppearingFlame{ void run(int timeroff, int timeron, int inittimer, int damage, int combo, int flag, int appeartime){ int trueappeartimer = appeartime; if(trueappeartimer == 0) trueappeartimer = 15; for(int i = 0; iPlaySound(87); bool hitthisframe; while(true){ for(int j = 0; jComboF[i] == flag || Screen->ComboI[i] == flag){ Screen->FastCombo(2, ComboX(i), ComboY(i), combo, 0, OP_TRANS); } } Waitframe(); } for(int j = 0; jComboF[i] == flag || Screen->ComboI[i] == flag){ Screen->FastCombo(2, ComboX(i), ComboY(i), combo, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(damage); hitthisframe = true; } } } hitthisframe = false; Waitframe(); } Game->PlaySound(84); for(int i = 0; iPlaySound(87); } } } ffc script BooEnemy{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this, enemyID); int originaldata = Ghost_Data; Ghost_Data = 1; Ghost_Waitframes(this, ghost, true, true,8); Ghost_Data = originaldata; Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); this->Flags[FFCF_OVERLAY] = 1; bool flip = false; bool stopped = false; this->Flags[FFCF_TRANS] = 1; int hesitation; int targetx; int targety; while (true){ targetx = Link->X; targety = Link->Y; // Grab the angle from the weapon to the enemy float angle = Angle(Ghost_X, Ghost_Y, targetx, targety); //adjust for direction if(targetx - Ghost_X > 0 && flip == false){ flip = true; Ghost_Data +=2; } if(targety - Ghost_X < 0 && flip == true){ flip = false; Ghost_Data -=2; } // Calculate the new location if(isLooking(0) == false && hesitation == 0){ Ghost_X += VectorX(ghost->Step/8, angle); Ghost_Y += VectorY(ghost->Step/8, angle); if(stopped == true){ Ghost_Data -= 1; stopped = false; } } else if(stopped == false){ Ghost_Data +=1; stopped = true; } if(Distance(Ghost_X, Ghost_Y, targetx, targety) <= 12) hesitation = 60; if(hesitation >0) hesitation--; Ghost_Waitframe(this, ghost, true, true); } } } //Check to see if Link is looking in enemy direction bool isLooking(int looker){ if(looker == 0){ if(Link->X - Ghost_X > 0 && Link->Dir == DIR_LEFT) return true; if(Link->X - Ghost_X < 0 && Link->Dir == DIR_RIGHT) return true; if(Link->Y - Ghost_Y > 0 && Link->Dir == DIR_UP) return true; if(Link->Y - Ghost_Y < 0 && Link->Dir == DIR_DOWN) return true; } } //Mask of Infamy // //This script will control the mask, and will spawn the heart //The idea here is that the mask is invulnerable until the heart //is dead. Once it is, the graphic will change, and the mask can be hit //from behind. //Behaves kind of like a rope, charging when it's in Link's line of sight // //Attribute 0 - The ID of the heart enemy to spawn //Attribute 1 - The first of 4 combos for when the mask when the heart is defeated //Attribute 2 - Height of the mask //Attribute 3 - Width of the mask //Attribute 4 - Speed at which to charge at Link //Attribute 5 - How 'percise' the mask needs to be in order to charge Link //Attribute 6 - If this is set to above 0, the enemy will immediately die when the heart dies //Arrtibute 7 - If this is set to above 0, the enemy will not explode upon death //Attribute 8 - How long, after charging, the mask waits before charging again ffc script maskOfInfamy{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this,enemyID,GHF_4WAY); int originaldata = Ghost_Data; Ghost_Data = 1; // lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, Ghost_X, Ghost_Y); // spawn->UseSprite(110); // spawn->Misc[CLW_TIMER] = 12; // spawn->CollDetection = false; Ghost_Waitframes(this, ghost, true, true,8); Ghost_Data = originaldata; Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); //Ghost_SpawnAnimationPuff(this,ghost); //Setting up our attributes with simple names, and in case I change //Which attribute does what later int ID = ghost->Attributes[0]; int secondPhaseCombo = ghost->Attributes[1]; int height = ghost->Attributes[2]; int width = ghost->Attributes[3]; int speed = ghost->Attributes[4]; int precision = ghost->Attributes[5]; int ifBoss = ghost->Attributes[6]; int ifExplode = ghost->Attributes[7]; int coolDown = ghost->Attributes[8]; bool charge; //Used to decide if we're going to rush Link or not bool second; //When the heart is dead, this'll indicate the 2nd phase int dir; //Charge direction int counter; //Used for movement // int walktarget; if(width > 1){ Ghost_SetHitOffsets(ghost, 6, 6, 6, 6); } // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE) // walktarget = Choose(0,1); // int targetcounter = Rand(180, 240); int chargeTimer; //Used to cool down before charging again //We'll store the current defenses, then switch to block everything int defense[18]; Ghost_StoreDefenses(ghost,defense); Ghost_SetAllDefenses(ghost,NPCDT_IGNORE); // while(G[G_ENEMYCOUNT_DELAY] > 0) // Ghost_Waitframe(this, ghost, true, true); Ghost_Transform(this,ghost,-1,-1,width,height); // if(G[G_DIFFICULTY] == DIF_EASY){ // Ghost_CSet = 11; // ghost->Damage -= 2; // ghost->WeaponDamage -=2; // } // else if(G[G_DIFFICULTY] == DIF_HARD || G[G_DIFFICULTY] == DIF_VHARD){ // Ghost_CSet = 8; // ghost->Damage += 4; // ghost->WeaponDamage +=4; // } int spawnpoint = FindSpawnPoint2P(true, false, false, false); while(Distance(ComboX(spawnpoint), ComboY(spawnpoint), Link->X, Link->Y) < 48) spawnpoint = FindSpawnPoint2P(true, false, false, false); lweapon spawn2 = CreateLWeaponAt(LW_SCRIPT6, ComboX(spawnpoint), ComboY(spawnpoint)); spawn2->UseSprite(22); spawn2->Misc[CLW_TIMER] = 12; spawn2->CollDetection = false; Ghost_Waitframes(this, ghost, true, true, 8); npc heart = CreateNPCAt(ID, ComboX(spawnpoint), ComboY(spawnpoint)); while(true){ //First, we'll check to see if we need to rush Link or not if(!charge && chargeTimer <= 0){ if(Link->X > Ghost_X && Abs(CenterLinkY() - CenterY(ghost)) < precision){ charge = true; dir = DIR_RIGHT; Ghost_Dir = DIR_RIGHT; } else if(Link->X < Ghost_X && Abs(CenterLinkY() - CenterY(ghost)) < precision){ charge = true; dir = DIR_LEFT; Ghost_Dir = DIR_LEFT; } else if(Link->Y > Ghost_Y && Abs(CenterLinkX() - CenterX(ghost)) < precision){ charge = true; dir = DIR_DOWN; Ghost_Dir = DIR_DOWN; } else if(Link->Y < Ghost_Y && Abs(CenterLinkX() - CenterX(ghost)) < precision){ charge = true; dir = DIR_UP; Ghost_Dir = DIR_UP; } // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // if(G[G_PLAYER_TWO_X]> Ghost_X && Abs(G[G_PLAYER_TWO_Y]+8 - CenterY(ghost)) < precision){ // charge = true; // dir = DIR_RIGHT; // Ghost_Dir = DIR_RIGHT; // } // else if(G[G_PLAYER_TWO_X] < Ghost_X && Abs(G[G_PLAYER_TWO_Y]+8 - CenterY(ghost)) < precision){ // charge = true; // dir = DIR_LEFT; // Ghost_Dir = DIR_LEFT; // } // else if(G[G_PLAYER_TWO_Y] > Ghost_Y && Abs(G[G_PLAYER_TWO_X]+8 - CenterX(ghost)) < precision){ // charge = true; // dir = DIR_DOWN; // Ghost_Dir = DIR_DOWN; // } // else if(G[G_PLAYER_TWO_Y] < Ghost_Y && Abs(G[G_PLAYER_TWO_X]+8 - CenterX(ghost)) < precision){ // charge = true; // dir = DIR_UP; // Ghost_Dir = DIR_UP; // } // } } if(width > 1){ int floatheight = 8*Sin(6*G[G_GLOBALFRAMES]); DrawTile(0, Ghost_X+16, Ghost_Y+24, 9245, 1, 1, 8, 32, 32, 0, 0, 0, 0, true, OP_OPAQUE); if(floatheight <=8 && floatheight >= -8) ghost->DrawYOffset = floatheight-4; } if(second){ if(Ghost_Dir == DIR_UP){ Screen->FastCombo(3, Ghost_X+8, Ghost_Y+4+ghost->DrawYOffset, 3467, 8, OP_OPAQUE); } } //We charge here if(charge){ if(Ghost_CanMove(dir,speed/100,4)) Ghost_Move(dir,speed/100,4); else{ charge = false; Ghost_Dir = OppositeDir(Ghost_Dir); chargeTimer = coolDown; } } else{ // if(G[G_DIFFICULTY] == DIF_VHARD) // counter = Ghost_2PlayerConstantWalk4(counter,ghost->Step+20,ghost->Rate,ghost->Homing+30,0, walktarget); // else // counter = Ghost_2PlayerConstantWalk4(counter,ghost->Step,ghost->Rate,ghost->Homing,0, walktarget); counter = Ghost_ConstantWalk4(counter,ghost->Step,ghost->Rate,ghost->Homing,0); // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // targetcounter--; // if(targetcounter == 0){ // if(Rand(0,1) == 1) // walktarget = Rand(0,1); // targetcounter = Rand(180,240); // } // } chargeTimer --; } //Check to see if the heart is still around if(!second && !heart->isValid()){ if(ifBoss > 0) Ghost_HP = 0; else{ second = true; Ghost_Transform(this,ghost,secondPhaseCombo,-1,-1,-1); Ghost_SetDefenses(ghost,defense); } } Ghost_Waitframe(this,ghost,false,false); //Checking if the boss is dead if(Ghost_HP <= 0){ if(ifExplode > 0) Ghost_Waitframe(this,ghost,true,true); else Ghost_DeathAnimation(this,ghost,1); Quit(); } } } } //Heart of Infamy // //This script will control the heart //Ideally, when this enemy dies, the mask will either die with it, or allow it to be damaged //Will move away from Link, while shooting if he gets too close // //Misc 0 - Height of the heart //Misc 1 - Width of the heart //Misc 2 - How close Link needs to get in order for the heart to shoot //Misc 3 - How often to shoot //Misc 4 - How many shots //Misc 5 - If set to above zero, the heart will not explode //Misc 6 - Speed of the weapon ffc script heartOfInfamy{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this,enemyID); // Ghost_SpawnAnimationPuff(this,ghost); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); // if(G[G_DIFFICULTY] == DIF_EASY){ // Ghost_CSet = 11; // Ghost_HP -= 200; // ghost->Damage -= 2; // ghost->WeaponDamage -=2; // } // else if(G[G_DIFFICULTY] == DIF_HARD || G[G_DIFFICULTY] == DIF_VHARD){ // Ghost_CSet = 8; // Ghost_HP += 200; // ghost->Damage += 4; // ghost->WeaponDamage +=4; // } int height = ghost->Attributes[0]; int width = ghost->Attributes[1]; int distance = ghost->Attributes[2]; int rate = ghost->Attributes[3]; int bulNumber = ghost->Attributes[4]; int ifExplode = ghost->Attributes[5]; int bulSpeed = ghost->Attributes[6]; int framecounter; int angle; int counter; int walkCounter; int targetx; int targety; Ghost_Transform(this,ghost,-1,-1,width,height); if(width > 1){ Ghost_SetHitOffsets(ghost, 6, 6, 6, 6); } while(true){ // if(G[G_MULTIPLAYER_ENABLED] == I_TRUE){ // if(Distance(Ghost_X, Ghost_Y, Link->X, Link->Y) <= Distance(Ghost_X, Ghost_Y, G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y])){ // targetx = Link->X; // targety = Link->Y; // } // else{ // targetx = G[G_PLAYER_TWO_X]; // targety = G[G_PLAYER_TWO_Y]; // } // } // else{ targetx = Link->X; targety = Link->Y; // } // if(width > 1){ // int floatheight = 8*Sin(6*G[G_GLOBALFRAMES]); // DrawTile(0, Ghost_X+16, Ghost_Y+24, 9245, 1, 1, 8, 32, 32, 0, 0, 0, 0, true, OP_OPAQUE); // if(floatheight <=8 && floatheight >= -8) // ghost->DrawYOffset = floatheight-4; // } // else // EnemyFloat(ghost, framecounter); int walkangle = Angle(Ghost_X, Ghost_Y, targetx, targety); if(Distance(Ghost_X, Ghost_Y, targetx, targety) <=64) Ghost_MoveAtAngle(walkangle-180, .5, 4); //walkCounter = Ghost_ConstantWalk8(walkCounter,ghost->Step,ghost->Rate,ghost->Homing*-1,0); //We're going to see if Link's close enough for us to start attacking if((Abs(Link->X-Ghost_X) <= distance && Abs(Link->Y-Ghost_Y) <= distance)){ //|| (G[G_MULTIPLAYER_ENABLED] == 1 && Abs(G[G_PLAYER_TWO_X]-Ghost_X) <= distance && Abs(G[G_PLAYER_TWO_Y]-Ghost_Y) <= distance) ){ counter++; //Time to shoot! if(counter >= rate){ for(int i; i < bulNumber; i++){ if(width > 1){ int fireangle = DegtoRad(Angle(Ghost_X+16, Ghost_Y+16, targetx+8, targety+8)); eweapon e = FireEWeapon(EW_FIREBALL,Ghost_X,Ghost_Y, fireangle, bulSpeed,ghost->WeaponDamage,17,SFX_FIREBALL, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_SINE_WAVE, 24, 2.8); } else{ // if(G[G_DIFFICULTY] == DIF_NORMAL) // FireEWeapon(EW_FIREBALL,Ghost_X,Ghost_Y,DegtoRad((360/bulNumber)*i),bulSpeed,ghost->WeaponDamage,17,SFX_FIREBALL,NULL); // else if(G[G_DIFFICULTY] == DIF_HARD || G[G_DIFFICULTY] == DIF_VHARD){ // FireEWeapon(EW_FIREBALL,Ghost_X,Ghost_Y,DegtoRad((360/bulNumber)*i),bulSpeed+100,ghost->WeaponDamage,17,SFX_FIREBALL,NULL); // FireEWeapon(EW_FIREBALL,Ghost_X,Ghost_Y,DegtoRad((360/bulNumber)*i+90),bulSpeed+100,ghost->WeaponDamage,17,SFX_FIREBALL,NULL); // } } counter = 0; } } } //Reset the counter if he's not close enough else counter = 0; if(framecounter > 60) framecounter -= 60; if(G[G_GLOBALFRAMES] %2) framecounter++; Ghost_Waitframe(this,ghost,false,false); if(Ghost_HP <= 0){ if(ifExplode > 0) Ghost_Waitframe(this,ghost,true,true); else Ghost_DeathAnimation(this,ghost,1); Quit(); } } } } int FindSpawnPoint2P(bool landOK, bool wallsOK, bool waterOK, bool pitsOK) { int tileRatings[176]; int checkCombo; int checkX; int checkY; int bestRating; int bestCount; int counter; int choice; int tries; npc otherNPC; // First, rate each tile for suitability. Lower is better, // but negative means it's strictly off-limits. // Tiles too close to other enemies are undesirable for(int i=Screen->NumNPCs(); i>0; i--) { otherNPC=Screen->LoadNPC(i); checkCombo=ComboAt(otherNPC->X, otherNPC->Y); tileRatings[checkCombo]+=100; if(checkCombo>15) tileRatings[checkCombo-16]+=1; if(checkCombo<160) tileRatings[checkCombo+16]+=1; if(checkCombo%16>0) tileRatings[checkCombo-1]+=1; if(checkCombo%16<15) tileRatings[checkCombo+1]+=1; } // Mark prohibited tiles for(int i=0; i<176; i++) { // Screen edges in NES dungeon if((Screen->Flags[SF_ROOMTYPE]&010b)!=0 && (i<32 || i>143 || i%16<2 || i%16>13)) tileRatings[i]=-1; // Water else if(IsWater(i)) { if(!waterOK) tileRatings[i]=-1; } // Pits else if(IsPit(i)) { if(!pitsOK) tileRatings[i]=-1; } // "No enemy" flag and combos else if(Screen->ComboF[i]==CF_NOENEMY || Screen->ComboI[i]==CF_NOENEMY || Screen->ComboT[i]==CT_NOENEMY || Screen->ComboT[i]==CT_NOFLYZONE || Screen->ComboT[i]==CT_NOJUMPZONE || Screen->ComboT[i]==CT_NOGROUNDENEMY) tileRatings[i]=-1; // Too close to Link else if(Abs(ComboX(i)-Link->X)<32 && Abs(ComboY(i)-Link->Y)<32) tileRatings[i]=-1; // else if(G[G_MULTIPLAYER_ENABLED] == 1 && Abs(ComboX(i)-G[G_PLAYER_TWO_X])<32 && Abs(ComboY(i)-G[G_PLAYER_TWO_Y])<32) // tileRatings[i]=-1; // All other combos else { // If land is okay, but not walls (i.e. walkable only) if(landOK && !wallsOK) { checkX=ComboX(i); checkY=ComboY(i); if(Screen->isSolid(checkX, checkY) || Screen->isSolid(checkX+8, checkY) || Screen->isSolid(checkX, checkY+8) || Screen->isSolid(checkX+8, checkY+8)) tileRatings[i]=-1; } // If walls are okay, but not land (i.e. unwalkable only) else if(!landOK && wallsOK) { checkX=ComboX(i); checkY=ComboY(i); if(!Screen->isSolid(checkX, checkY) || !Screen->isSolid(checkX+8, checkY) || !Screen->isSolid(checkX, checkY+8) || !Screen->isSolid(checkX+8, checkY+8)) tileRatings[i]=-1; } // Neither land nor walls are okay else if(!landOK && !wallsOK) tileRatings[i]=-1; } } // Find the best rating and count the number of tiles with that rating bestRating=10000; bestCount=0; for(int i=0; i<176; i++) { if(tileRatings[i]<0) continue; if(tileRatings[i]==bestRating) bestCount++; else if(tileRatings[i]0; choice++) { if(tileRatings[choice]==bestRating) counter--; } // Subtract 1 because the for loop overshot return choice-1; } int FindSpawnPoint2P(int type, int flag) { int tileRatings[176]; int checkCombo; int checkX; int checkY; int bestRating; int bestCount; int counter; int choice; int tries; npc otherNPC; // Too close to other enemies for(int i=Screen->NumNPCs(); i>0; i--) { otherNPC=Screen->LoadNPC(i); checkCombo=ComboAt(otherNPC->X, otherNPC->Y); tileRatings[checkCombo]+=100; if(checkCombo>15) tileRatings[checkCombo-16]+=1; if(checkCombo<160) tileRatings[checkCombo+16]+=1; if(checkCombo%16>0) tileRatings[checkCombo-1]+=1; if(checkCombo%16<15) tileRatings[checkCombo+1]+=1; } // Mark prohibited tiles for(int i=0; i<176; i++) { // Wrong combo type if(type>=0) { if(Screen->ComboT[i]!=type) tileRatings[i]=-1; } // Flag isn't present if(flag>=0) { if(Screen->ComboF[i]!=flag && Screen->ComboI[i]!=flag) tileRatings[i]=-1; } // Too close to Link else if(Abs(ComboX(i)-Link->X)<32 && Abs(ComboY(i)-Link->Y)<32) tileRatings[i]=-1; // else if(G[G_MULTIPLAYER_ENABLED] == 1 && Abs(ComboX(i)-G[G_PLAYER_TWO_X])<32 && Abs(ComboY(i)-G[G_PLAYER_TWO_Y])<32) // tileRatings[i]=-1; } // Find the best rating and count the tiles bestRating=10000; bestCount=0; for(int i=0; i<176; i++) { if(tileRatings[i]<0) continue; if(tileRatings[i]==bestRating) bestCount++; else if(tileRatings[i]0; choice++) { if(tileRatings[choice]==bestRating) counter--; } return choice-1; } void EnemyFloat(npc enemy, int timer){ int floatheight = 4*Sin(6*timer); Screen->FastTile(0, Ghost_X, Ghost_Y+2, 27401, 7, OP_OPAQUE); if(floatheight <=4 && floatheight >= -4) enemy->DrawYOffset = floatheight-4; } void CharacterShift(){ if(Link->PressEx1 && G[G_RIGGSJOINED] == 1){ if(!Link->Item[RING_RIGGS] && !Link->Item[RING_ALIYA]){ //Kell to Riggs/Aliya if(G[G_ALIYAINPARTY] == 1){ Link->Item[RING_ALIYA] = true; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 203 || G[i] == 205){ G[i] = 216; } } } else{ Link->Item[RING_RIGGS] = true; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 203 || G[i] == 205){ if(Link->Item[207]) G[i] = 207; else G[i] = 206; } } } } else if(Link->Item[RING_RIGGS] || Link->Item[RING_ALIYA]){ //Riggs/Aliya to Kell Link->Item[RING_RIGGS] = false; Link->Item[RING_ALIYA] = false; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 206 || G[i] == 207 || G[i] == 216){ if(Link->Item[205]) G[i] = 205; else G[i] = 203; } } } } } ffc script Stepswitchalt{ void run(int switchortrigger){ while(true){ if(switchortrigger == 0){ if(Distance(Link->X, Link->Y, this->X, this->Y) <3 && !Screen->State[ST_BOSSLOCKBLOCK]){ Screen->TriggerSecrets(); Screen->State[ST_BOSSLOCKBLOCK] = true; Game->PlaySound(9); } } else{ if(Screen->State[ST_BOSSLOCKBLOCK]){ Screen->TriggerSecrets(); Quit(); } } Waitframe(); } } } ffc script ScriptOfMiscFunctions{ //For all the tiny little scripts like changing one combo that do not deserve their own FFC Scripts void run(int which, int which2, int which3){ if(which == 0){ //Bomb wall in level 5 on the pit if(Screen->State[ST_DOORLEFT]){ Screen->ComboD[ComboAt(32, 80)] = 4253; } } if(which == 1){ //Permanent enemies->Secrets in NES dungeons if(Screen->D[0] == 1){ Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; Quit(); } Waitframes(8); while(Screen->NumNPCs() > 0) Waitframe(); Screen->D[0] = 1; Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; } if(which == 2){ //Spawning the fish orb if(G[G_FISHORBCREATED] == 1) this->Data++; else{ while(Distance(Link->X, Link->Y, this->X, this->Y) >4) Waitframe(); Game->PlaySound(27); this->Data++; G[G_FISHORBCREATED] = 1; } } if(which == 3){ //Setting areas to visited; G[G_AREAVISITEDSTART + which2] = 1; } if(which == 4 && G[G_RANDO] == 1){ //Randomizer if(which3 == 0){ for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 27){ //Npc script, this is a tablet room f->Data = 0; f->Script = 0; Screen->RoomType = RT_SPECIALITEM; } } Screen->RoomData = ItemIDToSpawn(ItemArray[which2]); } else if(which3 == 3){ int theitem; if(Game->GetCurMap() == 7){ if(G[G_LASTSCREEN] == 0x56) theitem = ItemArray[58]; if(G[G_LASTSCREEN] == 0x23) theitem = ItemArray[26]; if(G[G_LASTSCREEN] == 0x20) theitem = ItemArray[24]; } else if(Game->GetCurMap() == 13){ if(G[G_LASTSCREEN] == 0x32) theitem = ItemArray[62]; if(G[G_LASTSCREEN] == 0x24) theitem = ItemArray[61]; } else if(Game->GetCurMap() == 6){ if(G[G_LASTSCREEN] != 0x46) Quit(); else theitem = ItemArray[55]; } else if(Game->GetCurMap() == 16){ if(G[G_LASTSCREEN] != 0x69) Quit(); else theitem = ItemArray[68]; } else theitem = ItemArray[which2]; while(true){ for(int i = Screen->NumItems(); i>0; i--){ item tem = Screen->LoadItem(i); if(tem->Pickup & IP_ST_SPECIALITEM){ item tem2 = CreateItemAt(ItemIDToSpawn(theitem), tem->X, tem->Y); tem2->Z = tem->Z; tem2->Pickup = IP_ST_SPECIALITEM | IP_HOLDUP; Remove(tem); Quit(); } } Waitframe(); } } else{ if(!Screen->State[ST_ITEM] && G[G_JUNKRANDO] == 1 && which2 >= 83 && which2 <= 101) Game->PlaySound(92); while(true){ for(int i = Screen->NumItems(); i>0; i--){ item tem = Screen->LoadItem(i); if(tem->Pickup & IP_ST_ITEM){ item tem2 = CreateItemAt(ItemIDToSpawn(ItemArray[which2]), tem->X, tem->Y); tem2->Z = tem->Z; tem2->Pickup = IP_ST_ITEM | IP_HOLDUP; Remove(tem); Quit(); } } Waitframe(); } } } if(which == 5){ //Timer while(true){ if(LinkCollision(this) && G[G_LIGHTTIMER]+50 < G[G_MAXLIGHTTIMER]){ G[G_LIGHTTIMER]+=50; if(G[G_GLOBALFRAMES] % 20 == 0) Game->PlaySound(23); } Waitframe(); } } if(which == 6){ //Hyrule Castle keep door if(Game->GetScreenState(18, 0x50, ST_SECRET) == true && Game->GetScreenState(18, 0x57, ST_SECRET) == true){ for(int i = 0; i<176; i++){ if(GetLayerComboF(1, i) == 98) SetLayerComboD(1, i, 0); } } } if(which == 7){ //The feather if(which2 == 0) DriftingObjectsCombo[7] = 1252; else DriftingObjectsCombo[7] = 5095; } if(which == 8){ //Better Firetrails while(true){ for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_FIRETRAIL){ eweapon flame = FireEWeapon(EW_FIREBALL, e->X, e->Y, 0, 0, e->Damage, 80, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(flame, EWL_TIMER, 420); SetEWeaponDeathEffect(flame, EWD_VANISH, 0); Remove(e); } } Waitframe(); } } if(which == 9){ //The L2 bridge while(true){ if(Screen->State[ST_LOCKBLOCK] == true){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 98) Screen->ComboD[i] = 0; } } Waitframe(); } } if(which == 10){ //Keeping Link in town in the intro int combo = ComboAt(176, 96); if(Game->GetCurScreen() == 0x77) combo = ComboAt(128, 96); while(true){ if(Link->Item[51]){ //Has Flippers if(GetLayerComboD(1, combo) == 4281) SetLayerComboD(1, combo, 4315); } else{ //Doesn't if(GetLayerComboD(1, combo) == 4315) SetLayerComboD(1, combo, 4281); } Waitframe(); } } if(which == 11){ //Preventing a soft lock in L1 on Rando if(G[G_RANDO] == 1 && Game->GetScreenState(1, 0x65, ST_DOORUP) && Game->GetScreenState(1, 0x33, ST_DOORUP) && !Game->GetScreenState(1, 0x54, ST_DOORLEFT)){ Screen->ComboD[ComboAt(this->X, this->Y)] = 743; } } if(which == 12){ if(!Screen->State[ST_SPECIALITEM] && G[G_JUNKRANDO] == 1) Game->PlaySound(92); } } } const int RESET_NPC_LAYER_ON_ENTRY = 1; //This fix will replace all CMB_NPC_SOLID tiles with CMB_NPC_HIDDEN //when entering the screen. This should prevent problems with shared //layers. If you don't want this fix, set it to 0. const int NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH = 1; //This will make the script wait until a called script //finishes before resuming, fixing issues where you talk //to the NPC a second time while you should be frozen const int LAYER_NPC = 2; //The layer NPCs use for solid combos const int CMB_NPC_HIDDEN = 1; //Non-solid combo used for hidden NPCs const int CMB_NPC_SOLID = 195; //Solid combo placed under visible NPCs const int LAYER_NPC_CANTALK = 4; //The layer used for the speech bubble const int CMB_NPC_CANTALK = 4277; //The combo used for the speech bubble const int CS_NPC_CANTALK = 7; //The CSet used for the speech bubble const int NPCBT_NONE = 0; //Regular NPCs const int NPCBT_FACELINK = 1; //NPCs that turn to face Link const int NPCBT_GUARDH = 2; //NPCs that move along a horizontal path const int NPCBT_GUARDV = 3; //NPCs that move along a vertical path ffc script NPCScript{ void run(int String, int ItemCheck, int Type, int Arg1, int Arg2, int NoSolid, int Script, int ScriptArg){ //Stores the NPC's combo, hides it int Combo = this->Data; this->Data = CMB_NPC_HIDDEN; //Waits until the NPC should appear and shows it if(ItemCheck<0){ while(!Link->Item[Abs(ItemCheck)]){ Waitframe(); } this->Data = Combo; if(Type==NPCBT_FACELINK){ this->Data = Combo + Arg1; } } else if(ItemCheck>0){ if(!Link->Item[Abs(ItemCheck)]){ this->Data = Combo; if(Type==NPCBT_FACELINK){ this->Data = Combo + Arg1; } } } else if(ItemCheck==0){ this->Data = Combo; if(Type==NPCBT_FACELINK){ this->Data = Combo + Arg1; } } //Saves the width and height of the FFC for collision checks int Width = 16; int Height = 16; if(this->EffectWidth!=16) Width = this->EffectWidth; else if(this->TileWidth>1) Width = this->TileWidth*16; if(this->EffectHeight!=16) Height = this->EffectHeight; else if(this->TileHeight>1) Height = this->TileHeight*16; //Wait until the screen is done scrolling to avoid a weird ZC crashing bug Waitframe(); while(Link->Action==LA_SCROLLING){ Waitframe(); } //Shared Layer Fix // if(RESET_NPC_LAYER_ON_ENTRY==1){ // if(Screen->LoadFFC(FindFFCRunning(this->Script))==this){ // for(int i=0; i<176; i++){ // if(GetLayerComboD(LAYER_NPC, i)==CMB_NPC_SOLID){ // SetLayerComboD(LAYER_NPC, i, CMB_NPC_HIDDEN); // } // } // } // } //Sets the space below the NPC or the space a guard NPC occupies to be solid // if(LAYER_NPC>-1&&NoSolid==0){ // if(Type==NPCBT_GUARDH){ // for(int x=Arg1; x<=Arg2+this->TileWidth-1; x++){ // for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){ // SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_SOLID); // } // } // } // else if(Type==NPCBT_GUARDV){ // for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){ // for(int y=Arg1; y<=Arg2+this->TileHeight-1; y++){ // SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_SOLID); // } // } // } // else{ // for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){ // for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){ // SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_SOLID); // } // } // } // } while(true){ //Removes NPCs if Link has the required item if(ItemCheck>0){ if(Link->Item[ItemCheck]){ this->Data = CMB_NPC_HIDDEN; if(LAYER_NPC>-1&&NoSolid==0){ if(Type==NPCBT_GUARDH){ for(int x=Arg1; x<=Arg2+this->TileWidth-1; x++){ for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){ SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_HIDDEN); } } } else if(Type==NPCBT_GUARDV){ for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){ for(int y=Arg1; y<=Arg2+this->TileHeight-1; y++){ SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_HIDDEN); } } } else{ for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){ for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){ SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_HIDDEN); } } } } Quit(); } } //Handles animation for turning NPCs if(Type==NPCBT_FACELINK&&(Link->X>0&&Link->X<240&&Link->Y>0&&Link->Y<160)){ if(Distance(CenterLinkX(), CenterLinkY(), CenterX(this), CenterY(this))Data = Combo + AngleDir4(Angle(CenterX(this), CenterY(this), CenterLinkX(), CenterLinkY())); else this->Data = Combo + Arg1; } //Handles movement for guard NPCs else if(Type==NPCBT_GUARDH){ if(Link->X>16*Arg1-32&&Link->X<16*Arg2+32&&Link->Y>this->Y-32&&Link->YY+32){ this->X = Clamp(this->X+(-this->X + Link->X)/4, 16*Arg1, 16*Arg2); } } else if(Type==NPCBT_GUARDV){ if(Link->X>this->X-32&&Link->XX+32&&Link->Y>16*Arg1-32&&Link->Y<16*Arg2+32){ this->Y = Clamp(this->Y+(-this->Y + Link->Y)/4, 16*Arg1, 16*Arg2); } } //Facing Up if(Link->Dir==DIR_UP&&Link->Y>=this->Y&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){ if(CMB_NPC_CANTALK>0) Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128); if(Link->PressA){ Link->InputA = false; Link->PressA = false; // Screen->Message(String); if(Arg1 == 1 && G[G_RIGGSJOINED] == 0) PlayTangoMessage(3, STYLE_KELL, 30620, 48, 8); else{ PlayTangoMessage(String, STYLE_FREEZE, ItemCheck, 48, 8); if(Arg1 == 1 && Arg2 != -1) G[G_TABLETSTART + Arg2] = 1; } if(Script>0){ int args[8] = {ScriptArg}; int i = RunFFCScript(Script, args); if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){ ffc f = Screen->LoadFFC(i); while(f->Script==Script){ Waitframe(); } } } } } //Facing Down else if(Link->Dir==DIR_DOWN&&Link->Y>=this->Y-16&&Link->Y<=this->Y+Height-16&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){ if(CMB_NPC_CANTALK>0) Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128); if(Link->PressA){ Link->InputA = false; Link->PressA = false; // Screen->Message(String); if(Arg1 == 1 && G[G_RIGGSJOINED] == 0) PlayTangoMessage(3, STYLE_KELL, 30620, 48, 8); else{ PlayTangoMessage(String, STYLE_FREEZE, ItemCheck, 48, 8); if(Arg1 == 1 && Arg2 != -1) G[G_TABLETSTART + Arg2] = 1; } if(Script>0){ int args[8] = {ScriptArg}; int i = RunFFCScript(Script, args); if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){ ffc f = Screen->LoadFFC(i); while(f->Script==Script){ Waitframe(); } } } } } //Facing Left else if(Link->Dir==DIR_LEFT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X&&Link->X<=this->X+Width){ if(CMB_NPC_CANTALK>0) Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128); if(Link->PressA){ Link->InputA = false; Link->PressA = false; // Screen->Message(String); if(Arg1 == 1 && G[G_RIGGSJOINED] == 0) PlayTangoMessage(3, STYLE_KELL, 30620, 48, 8); else{ PlayTangoMessage(String, STYLE_FREEZE, ItemCheck, 48, 8); if(Arg1 == 1 && Arg2 != -1) G[G_TABLETSTART + Arg2] = 1; } if(Script>0){ int args[8] = {ScriptArg}; int i = RunFFCScript(Script, args); if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){ ffc f = Screen->LoadFFC(i); while(f->Script==Script){ Waitframe(); } } } } } //Facing Right else if(Link->Dir==DIR_RIGHT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-16&&Link->X<=this->X+Width-16){ if(CMB_NPC_CANTALK>0) Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128); if(Link->PressA){ Link->InputA = false; Link->PressA = false; // Screen->Message(String); if(Arg1 == 1 && G[G_RIGGSJOINED] == 0) PlayTangoMessage(3, STYLE_KELL, 30620, 48, 8); else{ PlayTangoMessage(String, STYLE_FREEZE, ItemCheck, 48, 8); if(Arg1 == 1 && Arg2 != -1) G[G_TABLETSTART + Arg2] = 1; } if(Script>0){ int args[8] = {ScriptArg}; int i = RunFFCScript(Script, args); if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){ ffc f = Screen->LoadFFC(i); while(f->Script==Script){ Waitframe(); } } } } } Waitframe(); } } } void PlayTangoStringInput(int string, int style, int tile, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); Waitframe(); } G[G_NOITEMS] = 2; } void PlayTangoString(int string, int style, int tile, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); Wait(); } G[G_NOITEMS] = 2; Link->InputA = false; Link->PressA = false; Wait(); } void PlayTangoMessage(int string, int style, int tile, int x, int y){ Tango_ClearSlot(0); Tango_LoadMessage(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); Wait(); } G[G_NOITEMS] = 2; } void StartTangoMessagePortraitless(int string, int style, int x, int y){ Tango_ClearSlot(0); Tango_LoadMessage(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); } void PlayTangoStringPortraitless(int string, int style, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; int xc; int yc; bool flash; int thetimer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } Wait(); } G[G_NOITEMS] = 2; } void PlayTangoStringI(int string, int style, int tile, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); WaitI(); } G[G_NOITEMS] = 2; } void PlayTangoStringPortraitlessI(int string, int style, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } WaitI(); } G[G_NOITEMS] = 2; } void PlayTangoStringBlackScreen(int string, int style, int tile, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); BlackScreenLayerSix(); Wait(); } G[G_NOITEMS] = 2; } void PlayTangoStringGhost(int string, int style, int tile, int x, int y, ffc this, npc ghost){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); G[G_NOITEMS] = 2; G[G_WAND_FIRE] = 0; G[G_WAND_TIMER] = 0; if(Link->HP < 16) Link->HP = 16; // Link->InputA = false; // Link->InputB = false; Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; Ghost_Waitframe(this, ghost, true, true); } G[G_NOITEMS] = 2; Link->InputA = false; Link->PressA = false; Wait(); } void TangoPortraiDraws(int tile){ if(G[G_SUBSCREENOPEN] == I_FALSE){ for(int i = 1; i>=0; i--){ int dataStart=i*__TANGO_SIZEOF_DATA; //My oh my int CurrentX = __Tango_SlotData[dataStart+__TSDIDX_SCREEN_X]; //We appear to be on an internal variable amusement park ride int CurrentY = __Tango_SlotData[dataStart+__TSDIDX_SCREEN_Y]; //Life is suffering and I just make witty remarks to stay sane int Style = __Tango_SlotData[dataStart+__TSDIDX_STYLE]; //Why did I sign up for this? if(Tango_SlotIsActive(i)){ int BorderTile = Tango_GetSlotStyleAttribute(i, TANGO_STYLE_BACKDROP_TILE); int BorderCSet = Tango_GetSlotStyleAttribute(i, TANGO_STYLE_BACKDROP_CSET); Screen->DrawTile(7, CurrentX-32, CurrentY, BorderTile-2, 2, 2, BorderCSet, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(tile != -1) Screen->FastTile(7, CurrentX-16, CurrentY+4, tile, 6, OP_OPAQUE); else Screen->FastTile(7, CurrentX-16, CurrentY+4, 30620 + Style, 6, OP_OPAQUE); } } } } void StartTangoString(int string, int style, int x, int y){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); } void StartTangoString(int string, int style, int slot, int x, int y){ Tango_ClearSlot(slot); Tango_LoadString(slot, string); Tango_SetSlotStyle(slot, style); Tango_SetSlotPosition(slot, x, y); Tango_ActivateSlot(slot); } void TangoWaitframe(int tile){ if(Tango_SlotIsActive(0)){ KillDirInput(); if(!Link->PressA || !Tango_SlotIsFinished(0)){ TangoPortraiDraws(tile); Waitframe(); } } } void TangoWaitframe(int tile, int frames){ for(int i = 0; iPressA || !Tango_SlotIsFinished(0)){ TangoPortraiDraws(tile); if(invs) WaitI(); else Wait(); } } } void TangoWaitframe(int tile, bool invs, int frames){ for(int i = 0; i 0; i--){ if(Link->HP < 16) Link->HP = 16; // Link->InputA = false; // Link->InputB = false; Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; Waitframe(); // } } void Wait(int frames){ for(int i = frames; i > 0; i--){ G[G_NOITEMS] = 2; if(Link->HP < 16) Link->HP = 16; // Link->InputA = false; // Link->InputB = false; Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; Waitframe(); } } void WaitI(){ G[G_NOITEMS] = 2; G[G_WAND_FIRE] = 0; G[G_WAND_TIMER] = 0; // for(int i = frames; i > 0; i--){ if(Link->HP < 16) Link->HP = 16; G[G_INVISIBLE] = 1; // Link->InputA = false; // Link->InputB = false; Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; Waitframe(); // } } void WaitI(int frames){ for(int i = frames; i > 0; i--){ G[G_NOITEMS] = 2; if(Link->HP < 16) Link->HP = 16; G[G_INVISIBLE] = 1; // Link->InputA = false; // Link->InputB = false; Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputEx1 = false; Link->InputEx2 = false; Link->InputEx3 = false; Link->InputEx4 = false; Link->PressEx1 = false; Link->PressEx2 = false; Link->PressEx3 = false; Link->PressEx4 = false; Link->InputStart = false; Link->PressStart = false; Link->PressMap = false; Link->InputMap = false; Link->InputL = false; Link->PressL = false; Link->InputR = false; Link->PressR = false; Waitframe(); } } const int STYLE_KELL = 1; const int STYLE_RIGGS = 2; const int STYLE_ZELDA = 3; const int STYLE_OTHER = 4; const int STYLE_INSTANT = 5; const int STYLE_PORTRAITLESS = 6; const int STYLE_ITEM = 7; const int STYLE_ALIYA = 8; const int STYLE_FREEZE = 9; const int STYLE_SYSTEM = 0; void SetUpStyles(){ //KELL Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_BACKDROP_CSET, 7); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_BACKDROP_TILE, 64002); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_KELL, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT); //RIGGS Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_BACKDROP_CSET, 8); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_BACKDROP_TILE, 63962); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_RIGGS, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT); //ZELDA Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_BACKDROP_CSET, 10); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_BACKDROP_TILE, 64002); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_ZELDA, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT); //Other Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_BACKDROP_CSET, 11); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_BACKDROP_TILE, 63962); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_OTHER, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT); //Instant Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_BACKDROP_CSET, 11); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_BACKDROP_TILE, 63962); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_SPEED, 0); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_TEXT_SFX, 0); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_INSTANT, TANGO_STYLE_FLAGS, TANGO_FLAG_INSTANTANEOUS); //Portraitless Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_BACKDROP_CSET, 11); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_BACKDROP_TILE, 63382); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_PORTRAITLESS, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT); //Instant Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_HEIGHT, 27); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_SPEED, 0); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_TEXT_SFX, 0); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_ITEM, TANGO_STYLE_FLAGS, TANGO_FLAG_INSTANTANEOUS); //Aliya Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_BACKDROP_CSET, 10); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_BACKDROP_TILE, 64002); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_ALIYA, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT); //Freeze Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_BACKDROP_TYPE, TANGO_BACKDROP_TILE); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_BACKDROP_CSET, 11); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_BACKDROP_TILE, 63962); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_BACKDROP_WIDTH, 10); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_BACKDROP_HEIGHT, 2); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_CSET, 0); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_COLOR, 1); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_WIDTH, 140); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_HEIGHT, 18); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_ALT_CSET_1, 8); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_ALT_COLOR_1, 1); Tango_SetStyleAttribute(STYLE_FREEZE, TANGO_STYLE_FLAGS, TANGO_FLAG_ENABLE_SPEEDUP | TANGO_FLAG_ENABLE_SUPER_SPEED | TANGO_FLAG_PERSISTENT | TANGO_FLAG_FREEZE_SCREEN); //System Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_FONT, TANGO_FONT_LTTP_SMALL); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_CSET, 11); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_COLOR, 14); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_X, 8); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_Y, 8); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_WIDTH, 124); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_HEIGHT, 36); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_SPEED, 5); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_TEXT_SFX, 18); Tango_SetStyleAttribute(STYLE_SYSTEM, TANGO_STYLE_FLAGS, TANGO_FLAG_INSTANTANEOUS | TANGO_FLAG_PERSISTENT); } const int ITEM_WAND = 25; const int ITEM_BOOK = 32; const int ITEM_BOOK2 = 213; const int FireCharge = 60; const int IceCharge = 180; const int ThunderCharge = 300; // ffc script Wand{ void Wand(){ // int FireCharge = 60; // int IceCharge = 180; // int ThunderCharge = 300; if(InputWeapon(ITEM_WAND)){ if(Link->Action != LA_SCROLLING && Link->Action != LA_SWIMMING && Link->Action != LA_DIVING && Link->Action != LA_HOLD1LAND && Link->Action != LA_HOLD2LAND && Link->SwordJinx == 0 && G[G_NOITEMS] == 0 && G[G_SUBSCREENOPEN] == 0){ G[G_WAND_FIRE] = 1; if(Link->Item[ITEM_BOOK] && G[G_WAND_TIMER] < ThunderCharge) G[G_WAND_TIMER]++; else if(!Link->Item[ITEM_BOOK] && Link->Item[ITEM_BOOK2] && G[G_WAND_TIMER] < IceCharge) G[G_WAND_TIMER]++; else if(!Link->Item[ITEM_BOOK2] && G[G_WAND_TIMER] < FireCharge) G[G_WAND_TIMER]++; if(G[G_GLOBALFRAMES]%5==0){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, Link->X+Rand(-8, 8), Link->Y-Link->Z+Rand(-8, 8)); if(G[G_WAND_TIMER] < FireCharge) l->UseSprite(141); else if(G[G_WAND_TIMER] < IceCharge) l->UseSprite(134); else if(G[G_WAND_TIMER] < ThunderCharge && Link->Item[ITEM_BOOK2]) l->UseSprite(135); else if(G[G_WAND_TIMER] < ThunderCharge && !Link->Item[ITEM_BOOK2]) l->UseSprite(134); else if(G[G_WAND_TIMER] == ThunderCharge) l->UseSprite(136); l->DeadState = l->NumFrames*l->ASpeed; } if(G[G_WAND_TIMER]==FireCharge-1){ Game->PlaySound(35); } if(G[G_WAND_TIMER]==IceCharge-1 && Link->Item[ITEM_BOOK2]){ Game->PlaySound(36); } if(G[G_WAND_TIMER]==ThunderCharge-1){ Game->PlaySound(76); } } } else{ if(G[G_WAND_FIRE] == 1 && Link->Action != LA_SCROLLING && Link->Action != LA_SWIMMING && Link->Action != LA_DIVING && Link->SwordJinx == 0){ G[G_WAND_FIRE] = 0; if((G[G_WAND_TIMER] >= FireCharge && G[G_WAND_TIMER] < IceCharge) ||(G[G_WAND_TIMER] >= FireCharge && G[G_WAND_TIMER] < ThunderCharge && !Link->Item[ITEM_BOOK2])){ lweapon Fire = CreateLWeaponAt(LW_BEAM, Link->X + RussInFrontX(Link->Dir, 0), Link->Y + RussInFrontY(Link->Dir, 0)); Fire->Damage = 2*G[G_WEAPON_MULTIPLIER]; Fire->UseSprite(38); Fire->Dir = Link->Dir; Fire->Step = 300; FireFlip(Fire); Fire->CollDetection = false; Game->PlaySound(32); Link->Action = LA_ATTACKING; } if(G[G_WAND_TIMER] >= IceCharge && G[G_WAND_TIMER] < ThunderCharge && Link->Item[ITEM_BOOK2]){ lweapon Fire = CreateLWeaponAt(LW_REFROCK, Link->X + RussInFrontX(Link->Dir, 0), Link->Y + RussInFrontY(Link->Dir, 0)); Fire->Damage = 4*G[G_WEAPON_MULTIPLIER]; Fire->UseSprite(102); Fire->Dir = Link->Dir; Fire->Step = 300; Game->PlaySound(32); Fire->CollDetection = false; Link->Action = LA_ATTACKING; } if(G[G_WAND_TIMER] >= ThunderCharge){ lweapon Fire = CreateLWeaponAt(LW_REFMAGIC, Link->X + RussInFrontX(Link->Dir, 0), Link->Y + RussInFrontY(Link->Dir, 0)); Fire->Damage = 4*G[G_WEAPON_MULTIPLIER]; Fire->UseSprite(131); Fire->Dir = Link->Dir; Fire->Step = 300; Fire->Misc[0] = 0; Game->PlaySound(32); Link->Action = LA_ATTACKING; } } G[G_WAND_TIMER] = 0; } if(Link->Action == LA_SWIMMING || Link->Action == LA_DIVING){ G[G_WAND_FIRE] = 0; G[G_WAND_TIMER] = 0; } } // } void FireFlip(lweapon light){ if(light->Dir == DIR_UP){ //Do nothing } else if(light->Dir == DIR_DOWN) light->Flip = 2; else if(light->Dir == DIR_LEFT){ light->UseSprite(39); light->Flip = 1; } else if(light->Dir == DIR_RIGHT) light->UseSprite(39); } ffc script FrozenEnemyBlocks{ void run(){ while(true){ int numblocks; for(int i = Screen->NumLWeapons(); i >0; i--){ lweapon block = Screen->LoadLWeapon(i); if(block->OriginalTile == 64332){ numblocks++; // if(!block->CollDetection){ if(Distance(Link->X, Link->Y, block->X, block->Y) <12){ Game->PlaySound(6); int angle = Angle(Link->X+8, Link->Y+8, block->X+8, block->Y+8); int blockdir = AngleDir4(angle); block->Dir = blockdir; // angle = DegtoRad(DirAngle8(blockdir)); // block->Angular = true; // block->Angle = angle; if(CanWalk(block->X, block->Y, block->Dir, block->Step/100, true)){ block->Step = 400; block->CollDetection = true; } } // else if(G[G_MULTIPLAYER_ENABLED] == 1 && Distance(G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y], block->X, block->Y) <12 && !Offscreen(G[G_PLAYER_TWO_X], G[G_PLAYER_TWO_Y])){ // Game->PlaySound(6); // int angle = Angle(G[G_PLAYER_TWO_X]+8, G[G_PLAYER_TWO_Y]+8, block->X+8, block->Y+8); // int blockdir = AngleDir4(angle); // angle = DegtoRad(DirAngle8(blockdir)); // block->Angular = true; // block->Angle = angle; // block->Step = 400; // } // } if(IceBlockForbidden(block->X, block->Y)) block->Misc[CLW_TIMER] = 2; } } if(numblocks == 0) Quit(); Waitframe(); } } } bool IceBlockForbidden(int TeleX, int TeleY){ if(Screen->isSolid(TeleX+2, TeleY+2)){ if(!IsWater(ComboAt(TeleX+2, TeleY+2))) return true; } if(Screen->isSolid(TeleX+13, TeleY+2)){ if(!IsWater(ComboAt(TeleX+13, TeleY+2))) return true; } if(Screen->isSolid(TeleX+2, TeleY+13)){ if(!IsWater(ComboAt(TeleX+2, TeleY+13))) return true; } if(Screen->isSolid(TeleX+13, TeleY+13)){ if(!IsWater(ComboAt(TeleX+13, TeleY+13))) return true; } return false; } bool Splitter(npc n){ if(n->ID == 273 || n->ID == 274) return true; else return false; } int DirAngle8(int Dir){ if(Dir==DIR_UP) return -90; else if(Dir==DIR_DOWN) return 90; else if(Dir==DIR_LEFT) return 180; else if(Dir==DIR_RIGHT) return 0; else if(Dir==DIR_LEFTUP) return -135; else if(Dir==DIR_RIGHTUP) return -45; else if(Dir==DIR_LEFTDOWN) return 135; else if(Dir==DIR_RIGHTDOWN) return 45; } bool Ghost_LynelCanMove(int dir, float step, int imprecision, bool inAir) { if(step==0) return true; if(dir>=4) // Diagonal step*=0.7071; dir=__NormalizeDir(dir); // More than 8 pixels? Step 8 at a time while(step>8) { if(!__Ghost_LynelCanMoveSingle(dir, step-8, imprecision, inAir)) return false; step-=8; } return __Ghost_LynelCanMoveSingle(dir, step, imprecision, inAir); } // Used by __Ghost_NewDir4() and __Ghost_NewDir8(). Uses the full step // on both axes if the direction is diagonal. bool __Ghost_LynelCanMoveNES(int dir, float step, int imprecision) { if(step==0) return true; // More than 8 pixels? Step 8 at a time while(step>8) { if(!__Ghost_LynelCanMoveSingle(dir, step-8, imprecision, Ghost_Z>0)) return false; step-=8; } return __Ghost_LynelCanMoveSingle(dir, step, imprecision, Ghost_Z>0); } // Check a single line for movability; needed when checking CanMove // over more than 8 pixels bool __Ghost_LynelCanMoveSingle(int dir, float step, int imprecision, bool inAir) { int i; float leadingEdge; // X or Y position of the leading edge int edgeSize; // Length of that edge (ignoring imprecision) float edgeStart; // X or Y at the top or left end of the leading edge int numCheckPoints; // Number of points to check, excluding endpoints if(dir==DIR_LEFT) { // The edge size is tile height minus hit box offsets edgeSize=16; // The leading edge is the left edge of the hitbox leadingEdge=Ghost_X+8-step; // The edge starts at the top of the hitbox edgeStart=Ghost_Y+16; // Check every eight pixels; -1 cuts off the last point numCheckPoints=edgeSize/8-1; // Check the non-end points for(i=1; i<=numCheckPoints; i++) { if(!Ghost_CanMovePixel(leadingEdge, edgeStart+i*8, inAir)) return false; } // Then the endpoints if(!Ghost_CanMovePixel(leadingEdge, edgeStart+imprecision, inAir)) return false; if(!Ghost_CanMovePixel(leadingEdge, edgeStart+edgeSize-imprecision-1, inAir)) return false; if(Ghost_X<=16) return false; return true; } else if(dir==DIR_RIGHT) { edgeSize=16; leadingEdge=Ghost_X+24-1+step; edgeStart=Ghost_Y+16; numCheckPoints=edgeSize/8-1; for(i=1; i<=numCheckPoints; i++) { if(!Ghost_CanMovePixel(leadingEdge, edgeStart+i*8, inAir)) return false; } if(!Ghost_CanMovePixel(leadingEdge, edgeStart+imprecision, inAir)) return false; if(!Ghost_CanMovePixel(leadingEdge, edgeStart+edgeSize-imprecision-1, inAir)) return false; return true; } else if(dir==DIR_UP) { // Most enemies can't move upward on sideview screens if(IsSideview() && !Ghost_FlagIsSet(GHF_NO_FALL)) return false; edgeSize=16; leadingEdge=Ghost_Y+16-step; edgeStart=Ghost_X+8; numCheckPoints=edgeSize/8-1; for(i=1; i<=numCheckPoints; i++) { if(!Ghost_CanMovePixel(edgeStart+i*8, leadingEdge, inAir)) return false; } if(!Ghost_CanMovePixel(edgeStart+imprecision, leadingEdge, inAir)) return false; if(!Ghost_CanMovePixel(edgeStart+edgeSize-imprecision-1, leadingEdge, inAir)) return false; return true; } else if(dir==DIR_DOWN) { edgeSize=16; leadingEdge=Ghost_Y+24-1+step; edgeStart=Ghost_X+8; numCheckPoints=edgeSize/8-1; for(i=1; i<=numCheckPoints; i++) { if(!Ghost_CanMovePixel(edgeStart+i*8, leadingEdge, inAir)) return false; } if(!Ghost_CanMovePixel(edgeStart+imprecision, leadingEdge, inAir)) return false; if(!Ghost_CanMovePixel(edgeStart+edgeSize-imprecision-1, leadingEdge, inAir)) return false; return true; } // Diagonal directions - move along one axis and test the other else if(dir==DIR_LEFTUP) { bool ret; Ghost_X-=step; ret=Ghost_LynelCanMove(DIR_UP, step, imprecision, inAir); Ghost_X+=step; if(!ret) return false; Ghost_Y-=step; ret=Ghost_LynelCanMove(DIR_LEFT, step, imprecision, inAir); Ghost_Y+=step; return ret; } else if(dir==DIR_RIGHTUP) { bool ret; Ghost_X+=step; ret=Ghost_LynelCanMove(DIR_UP, step, imprecision, inAir); Ghost_X-=step; if(!ret) return false; Ghost_Y-=step; ret=Ghost_LynelCanMove(DIR_RIGHT, step, imprecision, inAir); Ghost_Y+=step; return ret; } else if(dir==DIR_LEFTDOWN) { bool ret; Ghost_X-=step; ret=Ghost_LynelCanMove(DIR_DOWN, step, imprecision, inAir); Ghost_X+=step; if(!ret) return false; Ghost_Y+=step; ret=Ghost_LynelCanMove(DIR_LEFT, step, imprecision, inAir); Ghost_Y-=step; return ret; } else if(dir==DIR_RIGHTDOWN) { bool ret; Ghost_X+=step; ret=Ghost_LynelCanMove(DIR_DOWN, step, imprecision, inAir); Ghost_X-=step; if(!ret) return false; Ghost_Y+=step; ret=Ghost_LynelCanMove(DIR_RIGHT, step, imprecision, inAir); Ghost_Y-=step; return ret; } else // Invalid direction return false; } bool Ghost_LynelCanMove(int dir, float step, int imprecision) { return Ghost_LynelCanMove(dir, step, imprecision, Ghost_Z>0); } float Ghost_LynelHaltingWalk4(int counter, int step, int rate, int homing, int hunger, int haltRate, int haltTime) { // Don't move while being knocked back if(__Ghost_KnockbackCounter>0) return counter; // The counter is actually two combined... int walkCounter; int haltCounter; if(counter==-1) { walkCounter=0; haltCounter=0; } else { walkCounter=counter*10000; haltCounter=counter>>0; } // Halted; just count down if(haltCounter>0) return haltCounter-1; // Trying to walk onto half solid combos will throw off the counter bool ftmSet=Ghost_FlagIsSet(GHF_FULL_TILE_MOVEMENT); if(!Ghost_FlagIsSet(GHF_IGNORE_SOLIDITY)) Ghost_SetFlag(GHF_FULL_TILE_MOVEMENT); step/=100; // If the enemy was knocked back into a wall, // check whether it's half a tile off the grid if((__Ghost_InternalFlags&__GHFI_KNOCKBACK_INTERRUPTED)!=0) { if(Ghost_X%16==8) // Half a tile off horizontally { // Fix direction bool canMoveLeft=__Ghost_LynelCanMoveNES(DIR_LEFT, 1, 0); bool canMoveRight=__Ghost_LynelCanMoveNES(DIR_RIGHT, 1, 0); // Can move both left and right (or neither, for some reason) if(canMoveLeft==canMoveRight) { // Don't change direction if already facing left or right if(!(Ghost_Dir==DIR_LEFT || Ghost_Dir==DIR_RIGHT)) Ghost_Dir=Choose(DIR_LEFT, DIR_RIGHT); } // Can only move left else if(canMoveLeft) Ghost_Dir=DIR_LEFT; // Can only move right else Ghost_Dir=DIR_RIGHT; walkCounter=Floor(8/step); } else if(Ghost_Y%16==8) // Half a tile off vertically { // Fix direction bool canMoveUp=__Ghost_LynelCanMoveNES(DIR_UP, 1, 0); bool canMoveDown=__Ghost_LynelCanMoveNES(DIR_DOWN, 1, 0); // Can move both up and down (or neither, for some reason) if(canMoveUp==canMoveDown) { // Don't change direction if already facing up or down if(!(Ghost_Dir==DIR_UP || Ghost_Dir==DIR_DOWN)) Ghost_Dir=Choose(DIR_UP, DIR_DOWN); } // Can only move up else if(canMoveUp) Ghost_Dir=DIR_UP; // Can only move down else Ghost_Dir=DIR_DOWN; walkCounter=Floor(8/step); } else // Aligned to the grid walkCounter=Floor(16/step); } if(walkCounter==0) { // Snap to the grid and possibly turn __Ghost_FixCoords(); walkCounter=Floor(16/step); if(counter==-1) { __Ghost_LynelNewDir4(rate, homing, hunger); // Halt? if(Rand(16)X)<16 && Abs(Ghost_Y-Link->Y)<16) { if(Link->Action==LA_GOTHURTLAND && (__Ghost_InternalFlags&__GHFI_HIT_LINK)==0) { Ghost_Dir^=1; walkCounter=Floor(16/step)-walkCounter; __Ghost_InternalFlags|=__GHFI_HIT_LINK; } } // Not touching Link - clear the flag else __Ghost_InternalFlags&=~__GHFI_HIT_LINK; walkCounter--; Ghost_LynelMove(Ghost_Dir, step, 0); if(!ftmSet) Ghost_UnsetFlag(GHF_FULL_TILE_MOVEMENT); if(walkCounter>0) return walkCounter/10000; else return -1; } void Ghost_LynelMoveXY(float xStep, float yStep, int imprecision) { // If this is sideview, most enemies can't move upward if(yStep<0 && IsSideview() && !Ghost_FlagIsSet(GHF_NO_FALL)) yStep=0; // If moving more than 8 pixels along either axis, go 8 at a time while(Abs(xStep)>8 || Abs(yStep)>8) { if(Abs(xStep)>=Abs(yStep)) { if(xStep>0) { Ghost_LynelMoveXY(8, 0, imprecision); xStep-=8; } else { Ghost_LynelMoveXY(-8, 0, imprecision); xStep+=8; } } else // yStep>=xStep { if(yStep>0) { Ghost_LynelMoveXY(0, 8, imprecision); yStep-=8; } else { Ghost_LynelMoveXY(0, -8, imprecision); yStep+=8; } } } int edge; // Position of leading edge int edgeDiff; // Difference between Ghost_X/Ghost_Y and edge int startHT; // The half-tile position where the edge starts int endHT; // And where it ends up if(xStep<0) // Left { edgeDiff=__Ghost_XOffsets>>8; edge=Ghost_X+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+xStep)/8); // If the edge ends up on the same half-tile line it's already on, // there's no need to check walkability if(startHT==endHT) edge+=xStep; else if(Ghost_LynelCanMove(DIR_LEFT, -xStep, imprecision)) edge+=xStep; else // Can't move all the way; snap to the grid edge=(edge>>3)<<3; Ghost_X=edge-edgeDiff; } else if(xStep>0) // Right { edgeDiff=16*Ghost_TileWidth-(__Ghost_XOffsets&0xFF)-1; edge=Ghost_X+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+xStep)/8); if(startHT==endHT) edge+=xStep; else if(Ghost_LynelCanMove(DIR_RIGHT, xStep, imprecision)) edge+=xStep; else edge=(((edge+7)>>3)<<3)-1; Ghost_X=edge-edgeDiff; } if(yStep<0) // Up { edgeDiff=__Ghost_YOffsets>>8; edge=Ghost_Y+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+yStep)/8); // If the edge ends up on the same half-tile line it's already on, // there's no need to check walkability if(startHT==endHT) edge+=yStep; else if(Ghost_LynelCanMove(DIR_UP, -yStep, imprecision)) edge+=yStep; else // Can't move all the way; snap to the grid edge=(edge>>3)<<3; Ghost_Y=edge-edgeDiff; } else if(yStep>0) // Down { edgeDiff=16*Ghost_TileHeight-(__Ghost_YOffsets&0xFF)-1; edge=Ghost_Y+edgeDiff; startHT=Floor(edge/8); endHT=Floor((edge+yStep)/8); if(startHT==endHT) edge+=yStep; else if(Ghost_LynelCanMove(DIR_DOWN, yStep, imprecision)) edge+=yStep; else edge=(((edge+7)>>3)<<3)-1; Ghost_Y=edge-edgeDiff; } if(Ghost_FlagIsSet(GHF_SET_DIRECTION) && (__Ghost_InternalFlags&__GHFI_DIR_FORCED)==0) { // Use 8 directions if 8-way flag is set if(Ghost_FlagIsSet(GHF_8WAY)) Ghost_Dir=AngleDir8(WrapAngle(ArcTan(xStep, yStep))*57.2958); // Otherwise, 4 directions else { if(Abs(xStep)X+8, Link->Y+8); Ghost_LynelMoveXY(VectorX(step, angle), VectorY(step, angle), imprecision); } // Used by walk functions to pick a new direction void __Ghost_LynelNewDir4(int rate, int homing, int hunger) { int newDir=-1; // Check solidity of surrounding combos bool combos[4]; int numDirs; int counter; for(int i=0; i<4; i++) { if(__Ghost_LynelCanMoveNES(i, 16, 0)) { combos[i]=true; numDirs++; } } // Trapped? if(numDirs==0) { Ghost_Dir=-1; return; } if(Rand(16)>=rate) { // Doesn't want to turn; keep going the same direction if possible if(combos[Ghost_Dir]) return; } // Pick a direction at random from the ones available counter=Rand(numDirs); for(int dir=0; dir<4; dir++) { if(!combos[dir]) continue; if(counter==0) { Ghost_Dir=dir; return; } else counter--; } } ffc script Lynel{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_4WAY); Ghost_Transform(this, ghost, 4284, 8, 2, 2); int counter = -1; // bool Active = ghost->Misc[1]; int Step = 0.95; int ArrowCooldown; int walkdir; int walkvalue; bool found; int vars[5] = {0, 0, 90, 0, 0}; //WallCounter, WallTimer, FireTimer, Active, ArrowHalt if(G[G_LYNELACTIVE] == 1) vars[3] = 1; else Ghost_Waitframes(this, ghost, true, true, 60); int MaxHP = Ghost_HP; while(true){ if(vars[3] == 0){ if(((Ghost_Dir == DIR_UP || Ghost_Dir == DIR_DOWN) && Link->X >= Ghost_X-8 && Link->X <= Ghost_X+32) || ((Ghost_Dir == DIR_LEFT || Ghost_Dir == DIR_RIGHT) && Link->Y >= Ghost_Y-8 && Link->Y <= Ghost_Y+32) || Distance(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8) <=64 || Ghost_HP < MaxHP){ vars[3] = 1; LynelMusic(); G[G_CURRENTSCREEN] = Game->GetCurScreen(); G[G_CURRENTDMAP] = Game->GetCurDMap(); G[G_LYNELMAP] = Game->GetCurMap(); G[G_LYNELSCREEN] = Game->GetCurScreen(); ffc Handler; for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 31){ Handler = f; break; } } G[G_WHICHLYNEL] = Handler->InitD[1]; } counter = Ghost_LynelHaltingWalk4(counter, 50, 6, 0, 0, 4, 120); } else{ G[G_LYNELACTIVE] = 1; while(Ghost_LynelCanMove(AngleDir4(Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8)), Step, 8)){ Ghost_Dir = AngleDir4(Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8)); Ghost_LynelMoveAtAngle(Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8), Step, 8); if(Ghost_LynelCanMove(AngleDir4(Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8)), Distance(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8), 8) && Rand(0, 120) == 120){ vars[4] = 1; int dashangle; for(int i = 0; i<30; i++){ if(i==15) dashangle = Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8); if(i>=15) Ghost_Dir = AngleDir4(dashangle); Lynel_Waitframe(this, ghost, vars); } Ghost_Data += 4; Game->PlaySound(30); while(Ghost_LynelCanMove(AngleDir4(dashangle), 3, 8)){ Ghost_Dir = AngleDir4(dashangle); Ghost_LynelMoveAtAngle(dashangle, 3, 8); Lynel_Sword(this, ghost, false); Lynel_Waitframe(this, ghost, vars); } vars[4] = 0; Ghost_Data -= 4; } Lynel_Waitframe(this, ghost, vars); } vars[0]++; if(vars[0] > 2){ //Too much, jump Lynel_Jump(this, ghost, vars); } int TryingDir = AngleDir4(Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8)); if(TryingDir == DIR_LEFT || TryingDir == DIR_RIGHT){ for(int i = 16; i<64; i+=16){ if(CanWalk(Ghost_X + 8, Ghost_Y + 16 - i, TryingDir, Step, true) && Ghost_LynelCanMove(DIR_UP, i, 8)){ walkdir = DIR_UP; walkvalue = i; found = true; break; } if(CanWalk(Ghost_X + 8, Ghost_Y + 16 + i, TryingDir, Step, true) && Ghost_LynelCanMove(DIR_DOWN, i, 8)){ walkdir = DIR_DOWN; walkvalue = i; found = true; break; } } } if(TryingDir == DIR_UP || TryingDir == DIR_DOWN){ for(int i = 16; i<64; i+=16){ if(CanWalk(Ghost_X + 8 - i, Ghost_Y + 16, TryingDir, Step, true) && Ghost_LynelCanMove(DIR_LEFT, i, 8)){ walkdir = DIR_LEFT; walkvalue = i; found = true; break; } if(CanWalk(Ghost_X + 8 + i, Ghost_Y + 16, TryingDir, Step, true) && Ghost_LynelCanMove(DIR_RIGHT, i, 8)){ walkdir = DIR_RIGHT; walkvalue = i; found = true; break; } } } if(found){ found = false; if(vars[1] == 0) vars[1] = 75; for(int i = 0; i< walkvalue/Step; i++){ Ghost_Dir = walkdir; Ghost_LynelMoveAtAngle(DirAngle(walkdir), Step, 8); Lynel_Waitframe(this, ghost, vars); } } else Lynel_Jump(this, ghost, vars); } Lynel_Waitframe(this, ghost, vars); } } void Lynel_Waitframe(ffc this, npc ghost, int vars){ if(vars[3] == 1){ G[G_LYNELHP] = ghost->HP; if(Ghost_Z == 0 && vars[4] == 0){ if(vars[2] == 0){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 200, ghost->WeaponDamage, 34, 1, EWF_ROTATE_360|EWF_UNBLOCKABLE); vars[2] = Rand(60, 150); } else vars[2]--; } if(vars[1] > 0){ vars[1]--; if(vars[1] == 0){ if(vars[0] > 0) vars[0]--; if(vars[0] > 0) vars[1] = 75; } } for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_SCRIPT1 && G[G_GLOBALFRAMES] % 3 == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, e->X+Rand(-8, 8), e->Y+Rand(-8, 8)); l2->UseSprite(131); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; } } } if(!Ghost_Waitframe(this, ghost, false, false)){ G[G_LYNELACTIVE] = 0; UndoLynelMusic(); Game->SetScreenState(G[G_LYNELMAP], G[G_LYNELSCREEN], ST_ENEMYNORETURN, true); G[G_LYNELITEMSTART + G[G_WHICHLYNEL]] = 1; Ghost_Explode(this, ghost); // item tem = CreateItemAt(39, ghost->X, ghost->Y); int Args[8]; Args[0] = 3; Args[1] = ghost->X; Args[2] = ghost->Y; RunFFCScript(31, Args); Quit(); } } void Lynel_Jump(ffc this, npc ghost, int vars){ vars[0] = 0; vars[1] = 0; int Angle = Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8); eweapon Jump = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 150, 0, 129, 0, EWF_NO_COLLISION); SetEWeaponMovement(Jump, EWM_THROW, -1, EWMF_DIE); Game->PlaySound(45); int timer; int oldz = Ghost_Z; bool swordstate; while(Jump->Z > 0 || timer <10 ){ if(Ghost_Z < oldz && !swordstate){ swordstate = true; Ghost_Data += 4; Game->PlaySound(30); } Ghost_X = Jump->X; Ghost_Y = Jump->Y; Ghost_Z = Jump->Z; oldz = Ghost_Z; timer++; Ghost_Dir = AngleDir4(Angle(Ghost_X+16, Ghost_Y+16, Link->X+8, Link->Y+8)); Screen->FastTile(0, Ghost_X+8, Ghost_Y+18, 27401, 7, OP_OPAQUE); if(swordstate) Lynel_Sword(this, ghost, false); Lynel_Waitframe(this, ghost, vars); } Remove(Jump); for(int i = 0; i<30; i++){ Lynel_Sword(this, ghost, true); Lynel_Waitframe(this, ghost, vars); } Ghost_Data -= 4; } void Lynel_Sword(ffc this, npc ghost, bool hitbox){ if(Ghost_Dir == DIR_UP){ Screen->DrawTile(1, Ghost_X, Ghost_Y - Ghost_Z - 16, 63972, 2, 2, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(hitbox){ eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y - 16, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } if(Ghost_Dir == DIR_DOWN){ Screen->DrawTile(1, Ghost_X, Ghost_Y - Ghost_Z + 16, 64012, 2, 2, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(hitbox){ eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X+8, Ghost_Y - 32, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } if(Ghost_Dir == DIR_LEFT){ Screen->DrawTile(1, Ghost_X-16, Ghost_Y - Ghost_Z, 64014, 2, 2, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(hitbox){ eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X-16, Ghost_Y+8, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } if(Ghost_Dir == DIR_RIGHT){ Screen->DrawTile(1, Ghost_X+16, Ghost_Y - Ghost_Z, 63974, 2, 2, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(hitbox){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X+32, Ghost_Y+8, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } } } void LynelMusic(){ int Music[] = "R6 - Lynel.gbs"; Game->SetDMapEnhancedMusic(0, Music, 11); Game->SetDMapEnhancedMusic(1, Music, 11); Game->SetDMapEnhancedMusic(3, Music, 11); Game->SetDMapEnhancedMusic(4, Music, 11); Game->SetDMapEnhancedMusic(12, Music, 11); Game->SetDMapEnhancedMusic(13, Music, 11); Game->SetDMapEnhancedMusic(16, Music, 11); Game->SetDMapEnhancedMusic(20, Music, 11); Game->PlayEnhancedMusic(Music, 11); } void UndoLynelMusic(){ int Music[] = "R6 - Hyrule.nsf"; Game->SetDMapEnhancedMusic(0, Music, 1); int Music1[] = "R6 - ShipGrave.nsf"; Game->SetDMapEnhancedMusic(1, Music1, 1); Game->SetDMapEnhancedMusic(3, Music1, 1); int Music2[] = "R6 - Z1.nsf"; Game->SetDMapEnhancedMusic(4, Music2, 19); int Music3[] = "Final Fantasy III (1990-04-27)(Square).nsf"; Game->SetDMapEnhancedMusic(12, Music3, 3); Game->SetDMapEnhancedMusic(13, Music3, 3); Game->SetDMapEnhancedMusic(20, Music3, 3); int Music4[] = "Mega Man 10.nsf"; Game->SetDMapEnhancedMusic(16, Music4, 27); int Music5[] = "R6 - Jungle.nsf"; Game->SetDMapEnhancedMusic(17, Music5, 1); if(Game->GetCurDMap() == 0) Game->PlayEnhancedMusic(Music, 1); if(Game->GetCurDMap() == 1 || Game->GetCurDMap() == 3) Game->PlayEnhancedMusic(Music1, 1); if(Game->GetCurDMap() == 4) Game->PlayEnhancedMusic(Music2, 19); if(Game->GetCurDMap() == 12 || Game->GetCurDMap() == 13|| Game->GetCurDMap() == 20) Game->PlayEnhancedMusic(Music3, 3); if(Game->GetCurDMap() == 16) Game->PlayEnhancedMusic(Music4, 27); if(Game->GetCurDMap() == 17) Game->PlayEnhancedMusic(Music5, 1); } ffc script LynelHandler{ void run(int function, int Xpos, int Ypos){ if(function == 0){ int vars[11]; //FlagtoQuit int EntryDir; int CurScreen = Game->GetCurScreen(); if(G[G_CURRENTSCREEN] == CurScreen-1) EntryDir = DIR_LEFT; else if(G[G_CURRENTSCREEN] == CurScreen+1) EntryDir = DIR_RIGHT; else if(G[G_CURRENTSCREEN] == CurScreen-16) EntryDir = DIR_UP; else if(G[G_CURRENTSCREEN] == CurScreen+16) EntryDir = DIR_DOWN; else //Entered a cave EntryDir = 10; G[G_CURRENTSCREEN] = Game->GetCurScreen(); G[G_CURRENTDMAP] = Game->GetCurDMap(); int EntryX = GridX(Link->X); int EntryY = GridY(Link->Y); if(Rand(0, 2) == 2 && EntryDir != 10){ //Shock arrows int StartX = Link->X + RussInFrontX(OppositeDir(EntryDir), 48); int StartY = Link->Y + RussInFrontY(OppositeDir(EntryDir), 48); for(int i = 0; i<3; i++){ vars[i*2+1] = StartX + Rand(-48, 48); vars[i*2+2] = StartY + Rand(-48, 48); } for(int i = 8; i<=10; i++) vars[i] = 135; vars[7] = 1; } else if(EntryDir == 10){ if(CountFFCsRunning(27) > 0){ ffc Tablet = Screen->LoadFFC(FindFFCRunning(27)); vars[1] = Tablet->X; vars[2] = Tablet->Y; vars[8] = 135; vars[3] = Tablet->X; vars[4] = Tablet->Y; vars[9] = 135; vars[5] = Tablet->X; vars[6] = Tablet->Y; vars[10] = 135; vars[7] = 1; Tablet->Script = 0; } else{ for(int i = 0; i<176; i++){ if(Screen->ComboT[i] == CT_CHEST){ vars[1] = ComboX(i); vars[2] = ComboY(i); vars[8] = 135; vars[3] = ComboX(i); vars[4] = ComboY(i); vars[9] = 135; vars[5] = ComboX(i); vars[6] = ComboY(i); vars[10] = 135; vars[7] = 1; } } } } for(int i = 0; i<30; i++) ShockWait(vars); if(EntryDir == DIR_LEFT){ for(int i = EntryX-32; i < EntryX; i++){ Screen->DrawCombo(2, i, EntryY, 4287, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); ShockWait(vars); } } else if(EntryDir == DIR_RIGHT){ for(int i = EntryX+32; i > EntryX; i--){ Screen->DrawCombo(2, i, EntryY, 4286, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); ShockWait(vars); } } else if(EntryDir == DIR_UP){ for(int i = EntryY-16; i < EntryY; i++){ Screen->DrawCombo(2, EntryX, i, 4285, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); ShockWait(vars); } } else if(EntryDir == DIR_DOWN){ for(int i = EntryY+32; i > EntryY; i--){ Screen->DrawCombo(2, EntryX, i, 4284, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); ShockWait(vars); } } else if(EntryDir == 10){ Game->PlaySound(29); for(int i = 0; i<25; i++) ShockWait(vars); } npc n = CreateNPCAt(283, EntryX, EntryY); n->HP = G[G_LYNELHP]; while(vars[0] == 0) Waitframe(); } if(function == 1){ if(G[G_LYNELACTIVE] == 1){ G[G_LYNELACTIVE] = 0; UndoLynelMusic(); } } if(function == 2){ if(G[G_LYNELACTIVE] == 0 && !Screen->State[ST_ENEMYNORETURN]){ npc n = CreateNPCAt(283, this->X, this->Y); while(true) Waitframe(); } else if(Screen->State[ST_ENEMYNORETURN]){ if(G[G_LYNELITEMSTART + Xpos] == 1){ item tem; if(G[G_RANDO] == 0) tem = CreateItemAt(39, this->X, this->Y); else tem = CreateItemAt(ItemIDToSpawn(ItemArray[72 + Xpos]), this->X, this->Y); tem->Pickup = IP_HOLDUP; while(tem->isValid()) Waitframe(); G[G_LYNELITEMSTART + Xpos] = 2; } } } if(function == 3){ item tem; if(G[G_RANDO] == 0) tem = CreateItemAt(39, Xpos, Ypos); else tem = CreateItemAt(ItemIDToSpawn(ItemArray[72 + G[G_WHICHLYNEL]]), Xpos, Ypos); tem->Pickup = IP_HOLDUP; G[G_LYNELITEMSTART + G[G_WHICHLYNEL]] = 1; while(tem->isValid()) Waitframe(); G[G_LYNELITEMSTART + G[G_WHICHLYNEL]] = 2; } } void ShockWait(int vars){ int Prelim; if(vars[7] == 1){ for(int i = 0; i<3; i++){ if(vars[i+8] > 0){ vars[i+8]-=3; Screen->FastTile(4, vars[i*2+1], vars[i*2+2] - vars[i+8], 21992, 5, OP_OPAQUE); Screen->FastTile(0, vars[i*2+1], vars[i*2+2], 27401, 7, OP_OPAQUE); if(G[G_GLOBALFRAMES] % 3 == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, vars[i*2+1]+Rand(-8, 8), vars[i*2+2] - vars[i+8]+Rand(-8, 8)); l2->UseSprite(131); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; } } else if(vars[i+8] == 0){ vars[i+8] = -1; eweapon e = CreateEWeaponAt(EW_BOMBBLAST, vars[i*2+1], vars[i*2+2]); e->UseSprite(129); if(Screen->ComboT[ComboAt(vars[i*2+1], vars[i*2+2])] == CT_CHEST) Screen->ComboD[ComboAt(vars[i*2+1], vars[i*2+2])] = 631; else if(Screen->ComboD[ComboAt(vars[i*2+1], vars[i*2+2])] == 4276) Screen->ComboD[ComboAt(vars[i*2+1], vars[i*2+2])] = 631; } else if(vars[i+8] == -1) Prelim++; } } for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon weapon = Screen->LoadEWeapon(i); if(weapon->ID == EW_BOMBBLAST){ Screen->FastTile(3, weapon->X, weapon->Y, 64312, 6, OP_OPAQUE); for(int i=1; i<=6; i++){ Screen->FastTile(3, weapon->X+VectorX(16, 360/6*i), weapon->Y+VectorY(16, 360/6*i), 64312, 6, OP_OPAQUE); } Prelim = 0; } } if(Prelim == 3) vars[0] = 1; Waitframe(); } } const int TIL_YESNOBOX = 64086; ffc script Shop{ void DrawPrice(int x, int y, int price){ Screen->DrawInteger(2, x, y-1, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x, y+1, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x-1, y, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x+1, y, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x-1, y-1, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x+1, y-1, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x-1, y+1, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x+1, y+1, FONT_Z3SMALL, 8, -1, -1, -1, price, 0, 128); Screen->DrawInteger(2, x, y, FONT_Z3SMALL, 1, -1, -1, -1, price, 0, 128); } void PlayTangoStringShop(int string, int style, int tile, int x, int y, int rupeecost, int alloycost, ffc this){ int pricexoffset = 2; Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); Waitframe(); } } void DisplayTangoStringShop(int string, int style, int tile, int x, int y, int rupeecost, int alloycost){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; } void run(int origitemid, int rupeecost, int alloycost, int requireditem, int riggsonly, int soldout, int shoptile){ int pricexoffset = 2; int itemid = origitemid; if(soldout > 0 && Screen->D[soldout] == 1){ this->Data = 0; Quit(); } if(requireditem > 0 && !Link->Item[requireditem]){ this->Data = 0; Quit(); } if((itemid == 29 && Link->Item[29]) || (itemid == 30 && (Link->Item[30] || Link->Item[29]))){ this->Data = 0; Quit(); } item tem; if(G[G_RANDO] == 1){ if(itemid == 198 || itemid == 199 || itemid == 8){ this->Data = 1; for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if(this==f){ itemid = ItemIDToSpawn(ItemArray[31 + i]); break; } } tem = CreateItemAt(itemid, this->X, this->Y); tem->HitYOffset = 300; } if(itemid == 210){ this->Data = 0; Quit(); } } int PriceString; int DefUp[] = "That's a Defense Up ring. It will permanently boost your defense by 25%. I'll need one Magical Alloy to enchant it."; int OffUp[] = "That's an Offense Up ring. It will permanently boost your attack by 25%. I'll need one Magical Alloy to enchant it."; int Shield[] = "That's a Ward Spell. It will block magical projectiles if they strike you from the front. I'll need one Magical Alloy to enchant it."; int Trident[] = "This Lightscale Trident will reach twice as far as your current one. I'll need one Magical Alloy to reforge it."; int Chains[] = "These Chains of Freedom will be much easier to swing all around you. They might even burn enemies. I'll need one Magical Alloy to reforge it."; int Potion[] = "This potion will restore half your maximum HP."; int MinPotion[] = "This potion will restore half your minimum HP."; int Bombs[] = "That's a pack of four bombs. Good for blowing open secret passages."; int Map[] = "This old map hints at the location of ancient tablets. Rumor says they guide the way to something important."; int Buy[] = "Do you want to buy it?"; int Forge[] = "Do you want me to reforge it?"; int NotEnough[] = "Sorry, you don't have the items I need to make this for you."; int NotEnough2[] = "Sorry, you don't have enough rupees for that."; while(true){ if((itemid == 29 && Link->Item[29]) || (itemid == 30 && Link->Item[30])){ this->Data = 0; Quit(); } if(G[G_RANDO] == 1 && !tem->isValid()){ tem = CreateItemAt(itemid, this->X, this->Y); tem->HitYOffset = 300; } DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); if(Link->X>=this->X-8&&Link->X<=this->X+8&&Link->Y==this->Y+8&&Link->Dir==DIR_UP&&Link->PressA){ if(itemid == 198) PlayTangoStringShop(OffUp, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 199) PlayTangoStringShop(DefUp, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 8) PlayTangoStringShop(Shield, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 205) PlayTangoStringShop(Trident, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 207) PlayTangoStringShop(Chains, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 29) PlayTangoStringShop(Potion, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 30) PlayTangoStringShop(MinPotion, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 3) PlayTangoStringShop(Bombs, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(itemid == 210) PlayTangoStringShop(Map, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); if(Game->Counter[CR_RUPEES]+Game->DCounter[CR_RUPEES]>=rupeecost && G[G_NUMALLOY] >= alloycost && (requireditem == 0 || Link->Item[requireditem])){ // PlayTangoStringShop(Buy, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); int Yes[] = "Yes"; int No[] = "No"; int YesNo[] = {Yes, No}; int CYes = 1; int CNo = 6; if(itemid == 205 || itemid == 206) DisplayTangoStringShop(Forge, STYLE_INSTANT, shoptile, 48, 8, rupeecost, alloycost); else DisplayTangoStringShop(Buy, STYLE_INSTANT, shoptile, 48, 8, rupeecost, alloycost); int handler[6]; while(handler[1] == 0){ DialogueBox_RunSingleFrame(handler, 48+30, 8+52, YesNo, TIL_DB_DIALOGUE_BOX, CS_DB_DIALOGUE_BOX, C_DB_DIALOGUE_BOX_BG, FONT_Z3SMALL, 1, TIL_DB_DIALOGUE_SELECTOR, CS_DB_DIALOGUE_SELECTOR); DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); TangoPortraiDraws(shoptile); WaitNoAction(); } Tango_ClearSlot(0); if(handler[0] == 0){ item itm = CreateItemAt(itemid, Link->X, Link->Y); itm->Pickup = IP_HOLDUP; Game->DCounter[CR_RUPEES]-=rupeecost; G[G_NUMALLOY] -= alloycost; if(itemid == 205){ if(!Link->Item[RING_RIGGS]){ ItemIDs[0] = 205; ItemTiles[0] = 19780; ItemCSets[0] = 7; } for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 203) G[i] = 205; } ItemPopup(19780, 7, 60); } if(itemid == 207){ if(Link->Item[RING_RIGGS]){ ItemIDs[0] = 207; ItemTiles[0] = 19900; ItemCSets[0] = 1; } for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 206) G[i] = 207; } ItemPopup(19900, 1, 61); } for(int i=0; i<10||Link->Action==LA_HOLD1LAND||Link->Action==LA_HOLD2LAND; i++){ DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); WaitNoAction(); } if(soldout > 0){ Screen->D[soldout] = 1; this->Data = 0; Quit(); } } else{ for(int i=0; i<10; i++){ DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); WaitNoAction(); } } } else{ DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); if(itemid == 3 || itemid == 29 || itemid == 30 || itemid == 210) PlayTangoStringShop(NotEnough2, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); else PlayTangoStringShop(NotEnough, STYLE_OTHER, shoptile, 48, 8, rupeecost, alloycost, this); for(int i=0; i<10; i++){ DrawPrice(this->X+pricexoffset, this->Y+18, rupeecost); WaitNoAction(); } } } Waitframe(); } } } ffc script SpreadingFire{ void run(int secret){ while(true){ for(int i = Screen->NumEWeapons(); i >0; i--){ eweapon magic = Screen->LoadEWeapon(i); if((magic->ID == EW_FIRE || magic->ID == EW_BEAM)&& magic->Misc[0] == 0){ if(G[G_GLOBALFRAMES] % 2 == 0){ if(Screen->ComboF[ComboAt(magic->X+8,magic->Y+8)] == 99){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X+8, magic->Y+8)), ComboY(ComboAt(magic->X+8, magic->Y+8))); fire->Step = 0; fire->UseSprite(109); fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; fire->Damage = magic->Damage; Game->PlaySound(13); Screen->ComboF[ComboAt(magic->X+8, magic->Y+8)] = 0; Screen->ComboD[ComboAt(magic->X+8, magic->Y+8)]++; if(secret>0) Screen->State[ST_SECRET] = true; } if(GetLayerComboF(2, ComboAt(magic->X+8,magic->Y+8)) == 99){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X+8, magic->Y+8)), ComboY(ComboAt(magic->X+8, magic->Y+8))); fire->Step = 0; fire->UseSprite(109); fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; fire->Damage = magic->Damage; Game->PlaySound(13); SetLayerComboD(2, ComboAt(magic->X+8,magic->Y+8), 0); SetLayerComboF(2, ComboAt(magic->X+8,magic->Y+8), 0); if(secret>0) Screen->State[ST_SECRET] = true; } } } } for(int i = Screen->NumLWeapons(); i >0; i--){ lweapon magic = Screen->LoadLWeapon(i); if((magic->ID == LW_FIRE || magic->ID == LW_BEAM)&& magic->Misc[0] == 0){ if(G[G_GLOBALFRAMES] % 2 == 0){ if(Screen->ComboF[ComboAt(magic->X+8,magic->Y+8)] == 99){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X+8, magic->Y+8)), ComboY(ComboAt(magic->X+8, magic->Y+8))); fire->Step = 0; fire->UseSprite(109); fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; fire->Damage = magic->Damage; Game->PlaySound(13); Screen->ComboF[ComboAt(magic->X+8, magic->Y+8)] = 0; Screen->ComboD[ComboAt(magic->X+8, magic->Y+8)]++; if(secret>0) Screen->State[ST_SECRET] = true; } if(GetLayerComboF(2, ComboAt(magic->X+8,magic->Y+8)) == 99){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X+8, magic->Y+8)), ComboY(ComboAt(magic->X+8, magic->Y+8))); fire->Step = 0; fire->UseSprite(109); fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; fire->Damage = magic->Damage; Game->PlaySound(13); SetLayerComboD(2, ComboAt(magic->X+8,magic->Y+8), 0); SetLayerComboF(2, ComboAt(magic->X+8,magic->Y+8), 0); if(secret>0) Screen->State[ST_SECRET] = true; } } } if(magic->ID == LW_FIRE && magic->Misc[0] == 1){ if(G[G_GLOBALFRAMES] % 10 == 0){ if(Screen->ComboF[ComboAt(magic->X-8,magic->Y)] == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X-8, magic->Y)), ComboY(ComboAt(magic->X-8, magic->Y))); fire->Step = 0; fire->UseSprite(109); fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; fire->Damage = magic->Damage; Game->PlaySound(13); Screen->ComboF[ComboAt(magic->X-8, magic->Y)] = 0; Screen->ComboD[ComboAt(magic->X-8, magic->Y)]++; } if(Screen->ComboF[ComboAt(magic->X+17,magic->Y)] == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X+17, magic->Y)), ComboY(ComboAt(magic->X+17, magic->Y))); fire->Step = 0; fire->UseSprite(109); fire->Damage = magic->Damage; fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; Game->PlaySound(13); Screen->ComboF[ComboAt(magic->X+17, magic->Y)] = 0; Screen->ComboD[ComboAt(magic->X+17, magic->Y)]++; } if(Screen->ComboF[ComboAt(magic->X,magic->Y-8)] == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X, magic->Y-8)), ComboY(ComboAt(magic->X, magic->Y-8))); fire->Step = 0; fire->UseSprite(109); fire->Damage = magic->Damage; fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; Game->PlaySound(13); Screen->ComboF[ComboAt(magic->X, magic->Y-8)] = 0; Screen->ComboD[ComboAt(magic->X, magic->Y-8)]++; } if(Screen->ComboF[ComboAt(magic->X,magic->Y+17)] == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X, magic->Y+17)), ComboY(ComboAt(magic->X, magic->Y+17))); fire->Step = 0; fire->UseSprite(35); fire->Damage = magic->Damage; fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; // Game->PlaySound(109); fire->Misc[CLW_TIMER] = 60; Screen->ComboF[ComboAt(magic->X, magic->Y+17)] = 0; Screen->ComboD[ComboAt(magic->X, magic->Y+17)]++; } if(GetLayerComboF(2, ComboAt(magic->X-8,magic->Y)) == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X-8, magic->Y)), ComboY(ComboAt(magic->X-8, magic->Y))); fire->Step = 0; fire->UseSprite(109); fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; fire->Damage = magic->Damage; Game->PlaySound(13); SetLayerComboD(2, ComboAt(magic->X-8,magic->Y), 0); SetLayerComboF(2, ComboAt(magic->X-8,magic->Y), 0); } if(GetLayerComboF(2, ComboAt(magic->X+17,magic->Y)) == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X+17, magic->Y)), ComboY(ComboAt(magic->X+17, magic->Y))); fire->Step = 0; fire->UseSprite(109); fire->Damage = magic->Damage; fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; Game->PlaySound(13); SetLayerComboD(2, ComboAt(magic->X+17,magic->Y), 0); SetLayerComboF(2, ComboAt(magic->X+17,magic->Y), 0); } if(GetLayerComboF(2, ComboAt(magic->X,magic->Y-8)) == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X, magic->Y-8)), ComboY(ComboAt(magic->X, magic->Y-8))); fire->Step = 0; fire->UseSprite(109); fire->Damage = magic->Damage; fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; Game->PlaySound(13); SetLayerComboD(2, ComboAt(magic->X,magic->Y-8), 0); SetLayerComboF(2, ComboAt(magic->X,magic->Y-8), 0); } if(GetLayerComboF(2, ComboAt(magic->X,magic->Y+17)) == 98){ lweapon fire = CreateLWeaponAt(LW_FIRE, ComboX(ComboAt(magic->X, magic->Y+17)), ComboY(ComboAt(magic->X, magic->Y+17))); fire->Step = 0; fire->UseSprite(35); fire->Damage = magic->Damage; fire->Misc[CLW_TIMER] = 60; fire->Misc[0] = 1; // Game->PlaySound(109); fire->Misc[CLW_TIMER] = 60; SetLayerComboD(2, ComboAt(magic->X,magic->Y+17), 0); SetLayerComboF(2, ComboAt(magic->X,magic->Y+17), 0); } } } } Waitframe(); } } } int DamageNumbers[65536]; const int NPCM_DAMAGENUMBERSLASTHP = 12; //npc->Misc[] index tracking the enemy's last HP //Tile and CSet for the first of 8 tiles for enemy damage numbers const int GFX_DAMAGENUMBERS_ENEMY = 64109; const int CS_DAMAGENUMBERS_ENEMY = 7; //Tile and CSet for the first of 8 tiles for enemy healing numbers const int GFX_DAMAGENUMBERS_ENEMYHEAL = 64149; const int CS_DAMAGENUMBERS_ENEMYHEAL = 5; //Tile and CSet for the first of 8 tiles for Link damage numbers const int GFX_DAMAGENUMBERS_LINK = 64129; const int CS_DAMAGENUMBERS_LINK = 8; //Tile and CSet for the first of 8 tiles for Link healing numbers const int GFX_DAMAGENUMBERS_LINKHEAL = 64149; const int CS_DAMAGENUMBERS_LINKHEAL = 5; //Width and height of damage number tiles in pixels const int DAMAGENUMBERS_WIDTH = 4; const int DAMAGENUMBERS_HEIGHT = 7; //Multiplier and number of decimal places shown for enemies const int DAMAGENUMBERS_ENEMY_MULTIPLIER = 1; const int DAMAGENUMBERS_ENEMY_DECIMAL_PLACES = -1; //Multiplier and number of decimal places shown for Link const int DAMAGENUMBERS_LINK_MULTIPLIER = 1; const int DAMAGENUMBERS_LINK_DECIMAL_PLACES = 0; const int DAMAGENUMBERS_MAX = 32; //The max number of damage numbers drawn to the screen at once const int DAMAGENUMBERS_FRAMES = 40; //How many frames the damage numbers last for const int DAMAGENUMBERS_SPAWNFRAMES = 24; //How many frames the damage numbers to appear (0 for instant) const int DAMAGENUMBERS_XOFF = 0; //X offset for the spawning point of the numbers const int DAMAGENUMBERS_YOFF = -8; //Y offset for the spawning point of the numbers const int DAMAGENUMBERS_YSPEED = -0.1; //The speed the number moves on the Y-axis (negative = upwards) const int DAMAGENUMBERS_BOUNCEHEIGHT = 6; //How high in pixels the numbers bounce on the Y axis const int DAMAGENUMBERS_LINKDAMAGECOOLDOWN = 16; //How often in frames the script can detect Link taking damage const int DAMAGENUMBERS_LINKHEALCOOLDOWN = 16; //How often in frames the script can detect Link healing HP const int DAMAGENUMBERS_ALLOW_LARGE_NEGATIVE = 0; //If 1, enemies with <-1000 HP can still draw damage numbers. This is usually used by scripts to kill enemies without making a death sound //Internal constants used by the script, don't change const int _DNUM_STARTINDEX = 16; const int _DNUM_INDICES = 5; const int _DNUM_LASTLINKHP = 0; const int _DNUM_LINKDAMAGECOOLDOWN = 1; const int _DNUM_LINKHEALCOOLDOWN = 2; const int _DNUM_LASTDMAP = 3; const int _DNUM_LASTSCREEN = 4; const int _DNUMI_X = 0; const int _DNUMI_Y = 1; const int _DNUMI_TYPE = 2; const int _DNUMI_DAMAGE = 3; const int _DNUMI_TIMER = 4; const int _DNUM_TYPE_ENEMYDAMAGE = 0; const int _DNUM_TYPE_ENEMYHEAL = 1; const int _DNUM_TYPE_LINKDAMAGE = 2; const int _DNUM_TYPE_LINKHEAL = 3; //Init function, clears the DamageNumbers[] array on every load void DamageNumbers_Init(){ int size = SizeOfArray(DamageNumbers); for(int i=0; iHP; DamageNumbers[_DNUM_LASTDMAP] = Game->GetCurDMap(); DamageNumbers[_DNUM_LASTSCREEN] = Game->GetCurScreen(); } //Update function for enemies. This can be combined with your own if you have one void DamageNumbers_UpdateEnemies(){ for(int i=Screen->NumNPCs(); i>0; i--){ npc n = Screen->LoadNPC(i); DamageNumbers_UpdateEnemyDamage(n); } } //Update function for individual enemies void DamageNumbers_UpdateEnemyDamage(npc n){ //Detect when the enemy's HP has changed if(n->HP!=n->Misc[NPCM_DAMAGENUMBERSLASTHP]){ //Ignore enemies that don't have conventional HP if(DamageNumbers_IgnoreEnemyType(n)) return; //NPCs with -1000 HP have usually been killed by scripts if(n->HP>-1000||DAMAGENUMBERS_ALLOW_LARGE_NEGATIVE){ //If it's less make a damage number if(n->HPMisc[NPCM_DAMAGENUMBERSLASTHP]){ if(GFX_DAMAGENUMBERS_ENEMY!=0){ DamageNumbers_AddNumberGFX(CenterX(n), CenterY(n)-DAMAGENUMBERS_HEIGHT/2, _DNUM_TYPE_ENEMYDAMAGE, Abs(n->HP-n->Misc[NPCM_DAMAGENUMBERSLASTHP])); } } //else if it wasn't 0 (just spawned in) make a healing number // else if(n->Misc[NPCM_DAMAGENUMBERSLASTHP]){ // if(GFX_DAMAGENUMBERS_ENEMYHEAL!=0){ // DamageNumbers_AddNumberGFX(CenterX(n), CenterY(n)-DAMAGENUMBERS_HEIGHT/2, _DNUM_TYPE_ENEMYHEAL, Abs(n->HP-n->Misc[NPCM_DAMAGENUMBERSLASTHP])); // } // } } //Update the change in HP n->Misc[NPCM_DAMAGENUMBERSLASTHP] = n->HP; } } //Function for finding enemies that should never show damage numbers bool DamageNumbers_IgnoreEnemyType(npc n){ bool invalidTypes[256]; invalidTypes[NPCT_GUY] = true; invalidTypes[NPCT_ROCK] = true; invalidTypes[NPCT_TRAP] = true; invalidTypes[NPCT_PROJECTILE] = true; invalidTypes[NPCT_NONE] = true; invalidTypes[NPCT_FAIRY] = true; return invalidTypes[n->Type]; } //Update function for Link void DamageNumbers_UpdateLink(){ //Cooldown timer for Link taking damage (for things that damage him every frame) if(DamageNumbers[_DNUM_LINKDAMAGECOOLDOWN]>0) DamageNumbers[_DNUM_LINKDAMAGECOOLDOWN]--; //Cooldown timer for Link healing (for things that heal him every frame) if(DamageNumbers[_DNUM_LINKHEALCOOLDOWN]>0) DamageNumbers[_DNUM_LINKHEALCOOLDOWN]--; //Whenever Link's HP changes if(G[G_HPDRAIN]!=G[G_DNUM_LASTLINKHPDRAIN] && G[G_SUPPRESSDAMAGENUMBERS] == 0){ //If he took damage and isn't on cooldown if(G[G_HPDRAIN]>G[G_DNUM_LASTLINKHPDRAIN]){ if(DamageNumbers[_DNUM_LINKDAMAGECOOLDOWN]<=0){ if(GFX_DAMAGENUMBERS_LINK!=0) DamageNumbers_AddNumberGFX(CenterLinkX(), CenterLinkY()-DAMAGENUMBERS_HEIGHT/2, _DNUM_TYPE_LINKDAMAGE, Abs(G[G_DNUM_LASTLINKHPDRAIN]-G[G_HPDRAIN])+1); DamageNumbers[_DNUM_LINKDAMAGECOOLDOWN] = DAMAGENUMBERS_LINKDAMAGECOOLDOWN; G[G_DNUM_LASTLINKHPDRAIN] = G[G_HPDRAIN]; } } else{ G[G_DNUM_LASTLINKHPDRAIN] = G[G_HPDRAIN]; } } if(Link->HP!=DamageNumbers[_DNUM_LASTLINKHP]){ //If he took damage and isn't on cooldown if(Link->HPHP-DamageNumbers[_DNUM_LASTLINKHP])); DamageNumbers[_DNUM_LINKHEALCOOLDOWN] = DAMAGENUMBERS_LINKHEALCOOLDOWN; DamageNumbers[_DNUM_LASTLINKHP] = Link->HP; } } } } //Update function for scripted damage number draws void DamageNumbers_UpdateNumberGFX(){ int j; //If the screen has changed, reset all damage numbers if(Game->GetCurDMap()!=DamageNumbers[_DNUM_LASTDMAP]||Game->GetCurScreen()!=DamageNumbers[_DNUM_LASTSCREEN]){ DamageNumbers_Init(); } //Cycle through all number indices for(int i=0; i0, is valid if(DamageNumbers[j+_DNUMI_TIMER]>0){ int type = DamageNumbers[j+_DNUMI_TYPE]; int damage = DamageNumbers[j+_DNUMI_DAMAGE]; //Draw all numbers based on type if(type==_DNUM_TYPE_ENEMYDAMAGE){ if(DAMAGENUMBERS_ENEMY_MULTIPLIER>0) damage *= DAMAGENUMBERS_ENEMY_MULTIPLIER; DamageNumbers_Draw(DamageNumbers[j+_DNUMI_X]+DAMAGENUMBERS_XOFF, DamageNumbers[j+_DNUMI_Y]+DAMAGENUMBERS_YOFF, GFX_DAMAGENUMBERS_ENEMY, CS_DAMAGENUMBERS_ENEMY, damage, DamageNumbers[j+_DNUMI_TIMER], DAMAGENUMBERS_ENEMY_DECIMAL_PLACES); } else if(type==_DNUM_TYPE_ENEMYHEAL){ if(DAMAGENUMBERS_ENEMY_MULTIPLIER>0) damage *= DAMAGENUMBERS_ENEMY_MULTIPLIER; DamageNumbers_Draw(DamageNumbers[j+_DNUMI_X]+DAMAGENUMBERS_XOFF, DamageNumbers[j+_DNUMI_Y]+DAMAGENUMBERS_YOFF, GFX_DAMAGENUMBERS_ENEMYHEAL, CS_DAMAGENUMBERS_ENEMYHEAL, damage, DamageNumbers[j+_DNUMI_TIMER], DAMAGENUMBERS_ENEMY_DECIMAL_PLACES); } else if(type==_DNUM_TYPE_LINKDAMAGE){ if(DAMAGENUMBERS_LINK_MULTIPLIER>0) damage *= DAMAGENUMBERS_LINK_MULTIPLIER; DamageNumbers_Draw(DamageNumbers[j+_DNUMI_X]+DAMAGENUMBERS_XOFF, DamageNumbers[j+_DNUMI_Y]+DAMAGENUMBERS_YOFF, GFX_DAMAGENUMBERS_LINK, CS_DAMAGENUMBERS_LINK, damage, DamageNumbers[j+_DNUMI_TIMER], DAMAGENUMBERS_LINK_DECIMAL_PLACES); } else if(type==_DNUM_TYPE_LINKHEAL){ if(DAMAGENUMBERS_LINK_MULTIPLIER>0) damage *= DAMAGENUMBERS_LINK_MULTIPLIER; DamageNumbers_Draw(DamageNumbers[j+_DNUMI_X]+DAMAGENUMBERS_XOFF, DamageNumbers[j+_DNUMI_Y]+DAMAGENUMBERS_YOFF, GFX_DAMAGENUMBERS_LINKHEAL, CS_DAMAGENUMBERS_LINKHEAL, damage, DamageNumbers[j+_DNUMI_TIMER], DAMAGENUMBERS_LINK_DECIMAL_PLACES); } DamageNumbers[j+_DNUMI_Y] += DAMAGENUMBERS_YSPEED; DamageNumbers[j+_DNUMI_TIMER]--; } } } //Function to add scripted damage number draws void DamageNumbers_AddNumberGFX(int x, int y, int type, int damage){ int j; //Cycle through all number indices for(int i=0; i0){ for(i=4; i>numDecimalPlaces; i--) digitsDc[i] = -1; } //Else (-1) clear the unused ones else{ for(i=1; digitsDc[i]==0&&i<4; i++) digitsDc[i] = -1; //If all decimal places are empty, the number is whole. Remove the decimal point if(digitsDc[1]==-1) digitsDc[0] = -1; } } //Find how many whole number places should be visible int placesWh = 1; if(num>=10000) placesWh = 5; else if(num>=1000) placesWh = 4; else if(num>=100) placesWh = 3; else if(num>=10) placesWh = 2; int digits[10]; int numDigits; //Put the whole and decimal digits into one array for(i=4; i>=0; i--){ if(digitsDc[i]>0){ digits[numDigits] = digitsDc[i]; numDigits++; } } for(i=0; i0, the Abs(Sin(k)) bounce animation has started. k is clamped so it only plays once. //Otherwise if spawnFreq is 0, all digits appear instantly if(k>=0||spawnFreq==0){ if(gfx>0) Screen->FastTile(6, tmpX, tmpY, gfx+digits[i], cs, 128); else Screen->FastCombo(6, tmpX, tmpY, Abs(gfx)+digits[i], cs, 128); } } } item script CandleYesSeriouslyZCSucks{ void run(int identifier){ for(int i = Screen->NumLWeapons(); i>0; i--){ lweapon l = Screen->LoadLWeapon(i); if(l->ID == LW_FIRE && l->Misc[1] == 1) Quit(); } if(identifier == 11){ lweapon Fire = CreateLWeaponAt(LW_FIRE, Link->X + RussInFrontX(Link->Dir, 0), Link->Y + RussInFrontY(Link->Dir, 0)); Fire->Damage = (250 + 2.5*G[G_WEAPON_MULTIPLIER]) * 0.5; Fire->UseSprite(12); Fire->Dir = Link->Dir; Fire->Misc[1] = 1; } else{ for(int i = 0; i< 8; i++){ lweapon Fire = CreateLWeaponAt(LW_FIRE, Link->X + VectorX(16, i*45), Link->Y + VectorY(16, i*45)); Fire->Damage = (250 + 2.5*G[G_WEAPON_MULTIPLIER]) * 0.5; Fire->UseSprite(12); Fire->Dir = AngleDir8(i*45); Fire->Angular = true; Fire->Angle = DegtoRad(i*45 + 45); Fire->Misc[1] = 1; } } // Fire->Step = 300; Game->PlaySound(13); Link->Action = LA_ATTACKING; } } const int SHUTTER_INVISIBLE_COMBO = 1; //Set this to a combo that when placed on a 4x4 FFC will be invisible. const int CMB_BOMBWALL_MARKER = 0; //Combo used for the hint marker when using the lens on a bomb wall const int CS_BOMBWALL_MARKER = 7; //CSet of the hint marker const int D_LTTPDOORS = 1; //Screen->D[] (0-7) index used for directional doors const int D_LTTPDOORID = 2; //Screen->D[] (0-7) index used for ID'd doors const int SHUTTER_USE_FFC_CSET = 1; //If 1, will set shutters to the FFC's CSet. Else keep the CSets below the FFC. const int SHUTTER_OPEN_FRAMES = 0; //How long in frames (60ths of a second) an animated shutter takes to open const int SHUTTER_LOCK_OPEN_FRAMES = 0; //How long in frames (60ths of a second) an animated locked door takes to open const int SHUTTER_BOSS_LOCK_OPEN_FRAMES = 0; //How long in frames (60ths of a second) an animated boss lock door takes to open const int SHUTTER_REPEAT_DELAY_FRAMES = 12; //Delay between a shutter closing and opening const int SHUTTER_LOCK_ACTIVATION_FRAMES = 12; //Delay when pushing against a locked door before it opens const int SFX_SHUTTER_OPEN = 9; //SFX of a shutter opening const int SFX_SHUTTER_CLOSE = 9; //SFX of a shutter closing const int SFX_LOCK_OPEN = 9; //SFX of a lock opening const int SFX_BOSS_LOCK_OPEN = 9; //SFX of a boss lock opening const int SFX_BOMB_WALL_OPEN = 9; //SFX of a bomb wall being blasted open const int LENS_MP_COST = 1; //The MP cost of the lens item //If you have different/more lens items in your quest, this function will need to be changed bool UsingLens(){ if(Link->MPInputA) return true; if(GetEquipmentB()==I_LENS&&Link->InputB) return true; return false; } bool BombWall_HoldingItemButton(int id){ if(GetEquipmentA()==id&&Link->InputA) return true; if(GetEquipmentB()==id&&Link->InputB) return true; return false; } //LttP Shutter //D0: Direction to the wall the shutter is on - 0: Up, 1: Down, 2: Left, 3: Right //D1: Trigger type for the shutter // 0: One way // 1: Kill enemies // 2: Push block // 3: Combo change // 4: Perm secret //D2: Combo position of the trigger combo for a combo change (3) shutter //D6: If using an opening animation, this is the first of the combo groups, starting with a closed door. // Opening combo groups should be arranged vertically and be made up of doors the same size as the FFC. //D7: If using an opening animation, this is the number of frames in the animation. ffc script LttP_Shutter{ void run(int dir, int openTrigger, int triggerPos, int d3, int d4, int layer, int openingCmb, int openingFrames){ int comboPos = ComboAt(this->X+8, this->Y+8); int closedCmb = this->Data; int openCmb = this->Data+4*this->TileHeight; this->Data = SHUTTER_INVISIBLE_COMBO; //Uncheck flags that make the FFC invisible during scrolling this->Flags[FFCF_LENSVIS] = false; this->Flags[FFCF_CHANGER] = false; int triggerCD = Screen->ComboD[triggerPos]; int triggerCC = Screen->ComboC[triggerPos]; int triggerCF = Screen->ComboF[triggerPos]; //Set opening combo relative to the open and closed states if not set if(openingCmb==0&&openingFrames>0){ openingCmb = closedCmb+2*(4*this->TileHeight); } int linkX = Link->X; int linkY = Link->Y; //If the script is running while the screen is scrolling, Link's position will be flipped. if(this->Flags[FFCF_PRELOAD]){ if(dir==DIR_UP||dir==DIR_DOWN){ if(linkY<=0) linkY = 160; else if(linkY>=160) linkY = 0; } else{ if(linkX<=0) linkX = 240; else if(linkX>=240) linkX = 0; } } // >using variables as labels // shiggydiggy int SHUTTER_STATE = 0; //0 = Closed, 1 = Opening, 2 = Open, 3 = Closing int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; int shutter[16] = {0, 0, openCmb, closedCmb, comboPos}; if(openTrigger==4&&Screen->State[ST_SECRET]){ //Doors triggered by secret state don't need to run if it's already set Shutter_SetCombos(this, layer, comboPos, openCmb); Quit(); } int shutterCooldown; //If Link entered from this shutter, push him out and close it if(Shutter_LinkCollide(this, dir, linkX, linkY, false)){ shutterCooldown = SHUTTER_REPEAT_DELAY_FRAMES; shutter[SHUTTER_STATE] = 2; //Open Shutter_SetCombos(this, layer, comboPos, openCmb); Waitframe(); while(Link->Action==LA_SCROLLING||Shutter_LinkCollide(this, dir, Link->X, Link->Y, true)){ if(Link->Action!=LA_SCROLLING) Shutter_MoveLink(dir); Waitframe(); } Shutter_EjectLink(this, dir); Shutter_Close(this, layer, shutter, openingFrames); } else{ if(this->Flags[FFCF_PRELOAD]){ Shutter_SetCombos(this, layer, comboPos, closedCmb); //Wait for screen to finish scrolling so Link doesn't get teleported during the animation Waitframe(); while(Link->Action==LA_SCROLLING){ Waitframe(); } } else Shutter_Close(this, layer, shutter, openingFrames); } bool open = false; bool wasBlock = false; bool blockPuzzle = false; if(Shutter_CountBlockTriggers()>0) blockPuzzle = true; int enemyCooldown = 12; while(true){ if(openTrigger==1){ //Enemies if(enemyCooldown>0) enemyCooldown--; else{ if(Shutter_CountNPCs()==0) open = true; } } else if(openTrigger==2){ //Block if(blockPuzzle){ //Block puzzle secrets should override screens that just have blocks if(Shutter_CountBlockTriggers()==0) open = true; } else{ if(Screen->MovingBlockX>-1||Screen->MovingBlockY>-1) wasBlock = true; else if(wasBlock) open = true; } } else if(openTrigger==3){ //Combo change if(triggerCD!=Screen->ComboD[triggerPos]||triggerCC!=Screen->ComboC[triggerPos]||triggerCF!=Screen->ComboF[triggerPos]){ open = true; } else{ if(!Shutter_LinkCollide(this, dir, Link->X, Link->Y, true)) open = false; } } else if(openTrigger==4){ //Perm secret if(Screen->State[ST_SECRET]) open = true; } if(shutter[SHUTTER_STATE]==0&&Shutter_LinkCollide(this, dir, Link->X, Link->Y, false)) Shutter_EjectLink(this, dir); //Open and close the shutter if it should be closed/open but isn't if(open&&shutter[SHUTTER_STATE]==0){ if(shutterCooldown>0) shutterCooldown--; else Shutter_Open(this, layer, shutter, openingFrames); } else if(!open&&shutter[SHUTTER_STATE]==2){ Shutter_Close(this, layer, shutter, openingFrames); shutterCooldown = SHUTTER_REPEAT_DELAY_FRAMES; } Shutter_Update(this, layer, shutter, openingCmb, openingFrames); Waitframe(); } } bool Shutter_Update(ffc this, int layer, int shutter, int openingCmb, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; int curFrame; if(shutter[SHUTTER_STATE]==1){ //Opening if(shutter[SHUTTER_FRAMES]>0){ shutter[SHUTTER_FRAMES]--; curFrame = Clamp(Floor((SHUTTER_OPEN_FRAMES-shutter[SHUTTER_FRAMES])/(SHUTTER_OPEN_FRAMES/openingFrames)), 0, openingFrames-1); Shutter_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], openingCmb+curFrame*(4*this->TileHeight)); } else{ Shutter_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_OPENCMB]); shutter[SHUTTER_STATE] = 2; //Open } } else if(shutter[SHUTTER_STATE]==3){ //Closing if(shutter[SHUTTER_FRAMES]>0){ shutter[SHUTTER_FRAMES]--; curFrame = Clamp(Floor(shutter[SHUTTER_FRAMES]/(SHUTTER_OPEN_FRAMES/openingFrames)), 0, openingFrames-1); Shutter_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], openingCmb+curFrame*(4*this->TileHeight)); } else{ Shutter_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_CLOSEDCMB]); shutter[SHUTTER_STATE] = 0; //Closed } } } void Shutter_Open(ffc this, int layer, int shutter, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; Game->PlaySound(SFX_SHUTTER_OPEN); if(openingFrames==0){ Shutter_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_OPENCMB]); shutter[SHUTTER_STATE] = 2; //Open } else{ shutter[SHUTTER_STATE] = 1; //Opening shutter[SHUTTER_FRAMES] = SHUTTER_OPEN_FRAMES; } } void Shutter_Close(ffc this, int layer, int shutter, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; Game->PlaySound(SFX_SHUTTER_CLOSE); if(openingFrames==0){ Shutter_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_CLOSEDCMB]); shutter[SHUTTER_STATE] = 0; //Closed } else{ shutter[SHUTTER_STATE] = 3; //Closing shutter[SHUTTER_FRAMES] = SHUTTER_OPEN_FRAMES; } } bool Shutter_SetCombos(ffc this, int layer, int comboPos, int cmb){ int w = this->TileWidth; int h = this->TileHeight; for(int x=0; xCSet); //Screen->ComboD[comboPos+x+y*16] = cmb+x+y*4; } } } // bool Shutter_LinkCollide(ffc this, int dir, int linkX, int linkY, bool fullTile){ // if(Link->Action==LA_SCROLLING||Link->X<0||Link->X>240||Link->Y<0||Link->Y>160) // return false; // int w = this->TileWidth; // int h = this->TileHeight; // int offset = 0; // if(fullTile) // offset = 16; // if(dir==DIR_UP){ // return (linkX>=this->X-16 && linkX<=this->X+w*16 && linkY <= Max(this->Y+h*16-16+offset-8, 0)); // } // else if(dir==DIR_DOWN){ // return (linkX>=this->X-16 && linkX<=this->X+w*16 && linkY >= this->Y-offset); // } // else if(dir==DIR_LEFT){ // return (linkY>=this->Y-16 && linkY<=this->Y+h*16 && linkX <= this->X+w*16-16+offset); // } // else if(dir==DIR_RIGHT){ // return (linkY>=this->Y-16 && linkY<=this->Y+h*16 && linkX >= this->X-offset); // } // } bool Shutter_MoveLink(int dir){ NoAction(); if(dir==DIR_UP){ Link->InputDown = true; if(!CanWalk(Link->X, Link->Y, DIR_DOWN, 1, false)) Link->Y++; } else if(dir==DIR_DOWN){ Link->InputUp = true; if(!CanWalk(Link->X, Link->Y, DIR_UP, 1, false)) Link->Y--; } else if(dir==DIR_LEFT){ Link->InputRight = true; if(!CanWalk(Link->X, Link->Y, DIR_RIGHT, 1, false)) Link->X++; } else if(dir==DIR_RIGHT){ Link->InputLeft = true; if(!CanWalk(Link->X, Link->Y, DIR_LEFT, 1, false)) Link->X--; } } // bool Shutter_EjectLink(ffc this, int dir){ // if(dir==DIR_UP) // Link->Y = this->Y+this->TileHeight*16-8; // else if(dir==DIR_DOWN) // Link->Y = this->Y-16; // else if(dir==DIR_LEFT) // Link->X = this->X+this->TileWidth*16; // else if(dir==DIR_RIGHT) // Link->X = this->X-16; // } int Shutter_CountNPCs(){ int count; for(int i=Screen->NumNPCs(); i>=1; i--){ npc n = Screen->LoadNPC(i); if(n->MiscFlags&(1<<3)) //Doesn't count as a beatable enemy flag continue; if(n->Type==NPCT_GUY||n->Type==NPCT_TRAP||n->Type==NPCT_PROJECTILE||n->Type==NPCT_NONE) continue; if(n->Type==NPCT_ZORA) //Borderline if this should be a skippable enemy. I believe most ZC behaviors skip it, so I've put it here continue; count++; } return count; } int Shutter_CountBlockTriggers(){ int count; for(int i=0; i<176; i++){ if(ComboFI(i, CF_BLOCKTRIGGER)) count++; } return count; } //A shorthand way to set a combo on the current layer. //Layer 0 is the screen itself. void __SetLayerComboC(int layer, int pos, int cset) { if (layer == 0) Screen->ComboC[pos] = cset; else Game->SetComboCSet(Screen->LayerMap(layer), Screen->LayerScreen(layer), pos, cset); } } bool Shutter_LinkCollide(ffc this, int dir, int linkX, int linkY, bool fullTile){ if(Link->Action==LA_SCROLLING||Link->X<0||Link->X>240||Link->Y<0||Link->Y>160) return false; int w = this->TileWidth; int h = this->TileHeight; int offset = 0; if(fullTile) offset = 16; if(dir==DIR_UP){ return (linkX>=this->X-16 && linkX<=this->X+w*16 && linkY <= Max(this->Y+h*16-16+offset-8, 0)); } else if(dir==DIR_DOWN){ return (linkX>=this->X-16 && linkX<=this->X+w*16 && linkY >= this->Y-offset); } else if(dir==DIR_LEFT){ return (linkY>=this->Y-16 && linkY<=this->Y+h*16 && linkX <= this->X+w*16-16+offset); } else if(dir==DIR_RIGHT){ return (linkY>=this->Y-16 && linkY<=this->Y+h*16 && linkX >= this->X-offset); } } bool Shutter_EjectLink(ffc this, int dir){ if(dir==DIR_UP) Link->Y = this->Y+this->TileHeight*16-8; else if(dir==DIR_DOWN) Link->Y = this->Y-16; else if(dir==DIR_LEFT) Link->X = this->X+this->TileWidth*16; else if(dir==DIR_RIGHT) Link->X = this->X-16; } //LttP Locked Door //D0: Direction to the wall the door is on - 0: Up, 1: Down, 2: Left, 3: Right //D1: Special ID of the door (0 for none, 1-16). Be sure to match it with the door on the other side so both open properly. //D6: If using an opening animation, this is the first of the combo groups, starting with a closed door. // Opening combo groups should be arranged vertically and be made up of doors the same size as the FFC. //D7: If using an opening animation, this is the number of frames in the animation. ffc script LttP_LockedDoor{ void run(int dir, int id, int d2, int d3, int d4, int layer, int openingCmb, int openingFrames){ int comboPos = ComboAt(this->X+8, this->Y+8); int closedCmb = this->Data; int openCmb = this->Data+4*this->TileHeight; this->Data = SHUTTER_INVISIBLE_COMBO; //Uncheck flags that make the FFC invisible during scrolling this->Flags[FFCF_LENSVIS] = false; this->Flags[FFCF_CHANGER] = false; //Set opening combo relative to the open and closed states if not set if(openingCmb==0&&openingFrames>0){ openingCmb = closedCmb+2*(4*this->TileHeight); } // >using variables as labels // shiggydiggy int SHUTTER_STATE = 0; //0 = Closed, 1 = Opening, 2 = Open, 3 = Closing int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; int shutter[16] = {0, 0, openCmb, closedCmb, comboPos}; //If screen D bit is set, open the door if(LockedDoor_CheckD(dir, id)){ if(this->Flags[FFCF_PRELOAD]){ LockedDoor_SetCombos(this, layer, comboPos, openCmb); Quit(); } else{ LockedDoor_Open(this, layer, shutter, openingFrames); } } else{ LockedDoor_SetCombos(this, layer, comboPos, closedCmb); } int lockCount = SHUTTER_LOCK_ACTIVATION_FRAMES; while(true){ if(shutter[SHUTTER_STATE]==0){ //Closed if(LockedDoor_DetectOpen(this, dir)){ if(lockCount>0) lockCount--; else if(LockedDoor_HasKey()){ LockedDoor_Open(this, layer, shutter, openingFrames); LockedDoor_SetD(dir, id); LockedDoor_TakeKey(); } } else lockCount = SHUTTER_LOCK_ACTIVATION_FRAMES; } LockedDoor_Update(this, layer, shutter, openingCmb, openingFrames); Waitframe(); } } bool LockedDoor_Update(ffc this, int layer, int shutter, int openingCmb, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; int curFrame; if(shutter[SHUTTER_STATE]==1){ //Opening if(shutter[SHUTTER_FRAMES]>0){ shutter[SHUTTER_FRAMES]--; curFrame = Clamp(Floor((SHUTTER_LOCK_OPEN_FRAMES-shutter[SHUTTER_FRAMES])/(SHUTTER_LOCK_OPEN_FRAMES/openingFrames)), 0, openingFrames-1); LockedDoor_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], openingCmb+curFrame*(4*this->TileHeight)); } else{ LockedDoor_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_OPENCMB]); shutter[SHUTTER_STATE] = 2; //Open } } } void LockedDoor_Open(ffc this, int layer, int shutter, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; Game->PlaySound(SFX_LOCK_OPEN); if(openingFrames==0){ LockedDoor_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_OPENCMB]); shutter[SHUTTER_STATE] = 2; //Open } else{ shutter[SHUTTER_STATE] = 1; //Opening shutter[SHUTTER_FRAMES] = SHUTTER_OPEN_FRAMES; } } bool LockedDoor_SetCombos(ffc this, int layer, int comboPos, int cmb){ int w = this->TileWidth; int h = this->TileHeight; for(int x=0; xCSet); //Screen->ComboD[comboPos+x+y*16] = cmb+x+y*4; } } } bool LockedDoor_DetectOpen(ffc this, int dir){ int hitboxX; int hitboxY; if(dir==DIR_UP){ hitboxX = this->X+this->TileWidth*8-8; hitboxY = this->Y+this->TileHeight*16-16; } else if(dir==DIR_DOWN){ hitboxX = this->X+this->TileWidth*8-8; hitboxY = this->Y; } else if(dir==DIR_LEFT){ hitboxX = this->X+this->TileWidth*16-16; hitboxY = this->Y+this->TileHeight*8-8; } else if(dir==DIR_RIGHT){ hitboxX = this->X; hitboxY = this->Y+this->TileHeight*8-8; } if(Link->X>=hitboxX-8&&Link->X<=hitboxX+8&&Link->Y>=hitboxY-16&&Link->Y<=hitboxY&&Link->InputDown&&Link->Dir==DIR_DOWN&&dir<2) return true; if(Link->X>=hitboxX-8&&Link->X<=hitboxX+8&&Link->Y>=hitboxY&&Link->Y<=hitboxY+8&&Link->InputUp&&Link->Dir==DIR_UP&&dir<2) return true; if(Link->X>=hitboxX-16&&Link->X<=hitboxX&&Link->Y>=hitboxY-8&&Link->Y<=hitboxY+8&&Link->InputRight&&Link->Dir==DIR_RIGHT&&dir>=2) return true; if(Link->X>=hitboxX&&Link->X<=hitboxX+16&&Link->Y>=hitboxY-8&&Link->Y<=hitboxY+8&&Link->InputLeft&&Link->Dir==DIR_LEFT&&dir>=2) return true; return false; } bool LockedDoor_CheckD(int dir, int id){ if(id>0) return Screen->D[D_LTTPDOORID]&(1<<(Clamp(id-1, 0, 15))); else return Screen->D[D_LTTPDOORS]&(1<0){ Screen->D[D_LTTPDOORID] |= (1<<(Clamp(id-1, 0, 15))); nextD = Game->GetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORID); Game->SetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORID, nextD|(1<<(Clamp(id-1, 0, 15)))); } else{ Screen->D[D_LTTPDOORS] |= (1<GetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORS); Game->SetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORS, nextD|(1<Item[I_MAGICKEY]) return true; if(Game->Counter[CR_KEYS]>0) return true; if(Game->LKeys[Game->GetCurLevel()]>0) return true; return false; } void LockedDoor_TakeKey(){ if(Link->Item[I_MAGICKEY]) return; if(Game->LKeys[Game->GetCurLevel()]>0) Game->LKeys[Game->GetCurLevel()]--; else if(Game->Counter[CR_KEYS]>0) Game->Counter[CR_KEYS]--; } //A shorthand way to set a combo on the current layer. //Layer 0 is the screen itself. void __SetLayerComboC(int layer, int pos, int cset) { if (layer == 0) Screen->ComboC[pos] = cset; else Game->SetComboCSet(Screen->LayerMap(layer), Screen->LayerScreen(layer), pos, cset); } } //LttP Boss Locked Door //D0: Direction to the wall the door is on - 0: Up, 1: Down, 2: Left, 3: Right //D1: Special ID of the door (0 for none, 1-16). Be sure to match it with the door on the other side so both open properly. //D6: If using an opening animation, this is the first of the combo groups, starting with a closed door. // Opening combo groups should be arranged vertically and be made up of doors the same size as the FFC. //D7: If using an opening animation, this is the number of frames in the animation. ffc script LttP_BossLockedDoor{ void run(int dir, int id, int d2, int d3, int d4, int layer, int openingCmb, int openingFrames){ int comboPos = ComboAt(this->X+8, this->Y+8); int closedCmb = this->Data; int openCmb = this->Data+4*this->TileHeight; this->Data = SHUTTER_INVISIBLE_COMBO; //Uncheck flags that make the FFC invisible during scrolling this->Flags[FFCF_LENSVIS] = false; this->Flags[FFCF_CHANGER] = false; //Set opening combo relative to the open and closed states if not set if(openingCmb==0&&openingFrames>0){ openingCmb = closedCmb+2*(4*this->TileHeight); } // >using variables as labels // shiggydiggy int SHUTTER_STATE = 0; //0 = Closed, 1 = Opening, 2 = Open, 3 = Closing int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; int shutter[16] = {0, 0, openCmb, closedCmb, comboPos}; //If screen D bit is set, open the door if(BossLockedDoor_CheckD(dir, id)){ if(this->Flags[FFCF_PRELOAD]){ BossLockedDoor_SetCombos(this, layer, comboPos, openCmb); Quit(); } else{ BossLockedDoor_Open(this, layer, shutter, openingFrames); } } else{ BossLockedDoor_SetCombos(this, layer, comboPos, closedCmb); } int lockCount = SHUTTER_LOCK_ACTIVATION_FRAMES; while(true){ if(shutter[SHUTTER_STATE]==0){ //Closed if(BossLockedDoor_DetectOpen(this, dir)){ if(lockCount>0) lockCount--; else if(BossLockedDoor_HasKey()){ BossLockedDoor_Open(this, layer, shutter, openingFrames); BossLockedDoor_SetD(dir, id); } } else lockCount = SHUTTER_LOCK_ACTIVATION_FRAMES; } BossLockedDoor_Update(this, layer, shutter, openingCmb, openingFrames); Waitframe(); } } bool BossLockedDoor_Update(ffc this, int layer, int shutter, int openingCmb, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; int curFrame; if(shutter[SHUTTER_STATE]==1){ //Opening if(shutter[SHUTTER_FRAMES]>0){ shutter[SHUTTER_FRAMES]--; curFrame = Clamp(Floor((SHUTTER_LOCK_OPEN_FRAMES-shutter[SHUTTER_FRAMES])/(SHUTTER_LOCK_OPEN_FRAMES/openingFrames)), 0, openingFrames-1); BossLockedDoor_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], openingCmb+curFrame*(4*this->TileHeight)); } else{ BossLockedDoor_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_OPENCMB]); shutter[SHUTTER_STATE] = 2; //Open } } } void BossLockedDoor_Open(ffc this, int layer, int shutter, int openingFrames){ int SHUTTER_STATE = 0; int SHUTTER_FRAMES = 1; int SHUTTER_OPENCMB = 2; int SHUTTER_CLOSEDCMB = 3; int SHUTTER_COMBOPOS = 4; Game->PlaySound(SFX_BOSS_LOCK_OPEN); if(openingFrames==0){ BossLockedDoor_SetCombos(this, layer, shutter[SHUTTER_COMBOPOS], shutter[SHUTTER_OPENCMB]); shutter[SHUTTER_STATE] = 2; //Open } else{ shutter[SHUTTER_STATE] = 1; //Opening shutter[SHUTTER_FRAMES] = SHUTTER_OPEN_FRAMES; } } bool BossLockedDoor_SetCombos(ffc this, int layer, int comboPos, int cmb){ int w = this->TileWidth; int h = this->TileHeight; for(int x=0; xCSet); //Screen->ComboD[comboPos+x+y*16] = cmb+x+y*4; } } } bool BossLockedDoor_DetectOpen(ffc this, int dir){ int hitboxX; int hitboxY; if(dir==DIR_UP){ hitboxX = this->X+this->TileWidth*8-8; hitboxY = this->Y+this->TileHeight*16-16; } else if(dir==DIR_DOWN){ hitboxX = this->X+this->TileWidth*8-8; hitboxY = this->Y; } else if(dir==DIR_LEFT){ hitboxX = this->X+this->TileWidth*16-16; hitboxY = this->Y+this->TileHeight*8-8; } else if(dir==DIR_RIGHT){ hitboxX = this->X; hitboxY = this->Y+this->TileHeight*8-8; } if(Link->X>=hitboxX-8&&Link->X<=hitboxX+8&&Link->Y>=hitboxY-16&&Link->Y<=hitboxY&&Link->InputDown&&Link->Dir==DIR_DOWN&&dir<2) return true; if(Link->X>=hitboxX-8&&Link->X<=hitboxX+8&&Link->Y>=hitboxY&&Link->Y<=hitboxY+8&&Link->InputUp&&Link->Dir==DIR_UP&&dir<2) return true; if(Link->X>=hitboxX-16&&Link->X<=hitboxX&&Link->Y>=hitboxY-8&&Link->Y<=hitboxY+8&&Link->InputRight&&Link->Dir==DIR_RIGHT&&dir>=2) return true; if(Link->X>=hitboxX&&Link->X<=hitboxX+16&&Link->Y>=hitboxY-8&&Link->Y<=hitboxY+8&&Link->InputLeft&&Link->Dir==DIR_LEFT&&dir>=2) return true; return false; } bool BossLockedDoor_CheckD(int dir, int id){ if(id>0) return Screen->D[D_LTTPDOORID]&(1<<(Clamp(id-1, 0, 15))); else return Screen->D[D_LTTPDOORS]&(1<<(4+Clamp(dir, 0, 3))); } void BossLockedDoor_SetD(int dir, int id){ int offset; if(dir==DIR_UP) offset = -16; else if(dir==DIR_DOWN) offset = 16; else if(dir==DIR_LEFT) offset = -1; else offset = 1; int nextD; if(id>0){ Screen->D[D_LTTPDOORID] |= (1<<(Clamp(id-1, 0, 15))); nextD = Game->GetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORID); Game->SetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORID, nextD|(1<<(Clamp(id-1, 0, 15)))); } else{ Screen->D[D_LTTPDOORS] |= (1<<(4+Clamp(dir, 0, 3))); nextD = Game->GetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORS); Game->SetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORS, nextD|(1<<(4+Clamp(OppositeDir(dir), 0, 3)))); } } bool BossLockedDoor_HasKey(){ if(Game->LItems[Game->GetCurLevel()]&LI_BOSSKEY) return true; return false; } //A shorthand way to set a combo on the current layer. //Layer 0 is the screen itself. void __SetLayerComboC(int layer, int pos, int cset) { if (layer == 0) Screen->ComboC[pos] = cset; else Game->SetComboCSet(Screen->LayerMap(layer), Screen->LayerScreen(layer), pos, cset); } } //LttP Bomb Wall //D0: Direction to the wall the door is on - 0: Up, 1: Down, 2: Left, 3: Right //D1: Special ID of the door (0 for none, 1-16). Be sure to match it with the door on the other side so both open properly. ffc script LttP_BombWall{ void run(int dir, int id, int d2, int d3, int d4, int layer, int d6, int d7){ int comboPos = ComboAt(this->X+8, this->Y+8); int openCmb = this->Data; int rubbleCmb = this->Data+4*this->TileHeight; this->Data = SHUTTER_INVISIBLE_COMBO; //Uncheck flags that make the FFC invisible during scrolling this->Flags[FFCF_LENSVIS] = false; this->Flags[FFCF_CHANGER] = false; //If screen D bit is set, open the door if(BombWall_CheckD(dir, id)){ BombWall_SetCombos(this, layer, comboPos, openCmb); // BombWall_SetRubble(this, dir, rubbleCmb); Quit(); } while(true){ //Draw a hint graphic when using the lens if(UsingLens()){ int x; int y; if(dir==DIR_UP){ x = this->X+this->TileWidth*8-8; y = this->Y+this->TileHeight*16-16; } else if(dir==DIR_DOWN){ x = this->X+this->TileWidth*8-8; y = this->Y; } else if(dir==DIR_LEFT){ x = this->X+this->TileWidth*16-16; y = this->Y+this->TileHeight*8-8; } else if(dir==DIR_RIGHT){ x = this->X; y = this->Y+this->TileHeight*8-8; } if(CMB_BOMBWALL_MARKER>0) Screen->FastCombo(6, x, y, CMB_BOMBWALL_MARKER, CS_BOMBWALL_MARKER, 128); } if(BombWall_DetectOpen(this, dir)){ BombWall_SetCombos(this, layer, comboPos, openCmb); // BombWall_SetRubble(this, dir, rubbleCmb); BombWall_SetD(dir, id); // Game->PlaySound(SFX_BOMB_WALL_OPEN); Quit(); } Waitframe(); } } bool BombWall_SetCombos(ffc this, int layer, int comboPos, int cmb){ int w = this->TileWidth; int h = this->TileHeight; for(int x=0; xCSet); //Screen->ComboD[comboPos+x+y*16] = cmb+x+y*4; } } } void BombWall_SetRubble(ffc this, int dir, int cmb){ int rubbleX; int rubbleY; if(dir==DIR_UP){ rubbleX = this->X+this->TileWidth*8-8; rubbleY = this->Y+this->TileHeight*16; } else if(dir==DIR_DOWN){ rubbleX = this->X+this->TileWidth*8-8; rubbleY = this->Y-16; } else if(dir==DIR_LEFT){ rubbleX = this->X+this->TileWidth*16; rubbleY = this->Y+this->TileHeight*8-8; } else if(dir==DIR_RIGHT){ rubbleX = this->X-16; rubbleY = this->Y+this->TileHeight*8-8; } this->Data = cmb; this->X = rubbleX; this->Y = rubbleY; this->TileWidth = 1; this->TileHeight = 1; } bool BombWall_DetectOpen(ffc this, int dir){ int hitboxX; int hitboxY; if(dir==DIR_UP){ hitboxX = this->X+this->TileWidth*8-8; hitboxY = this->Y+this->TileHeight*16-16; } else if(dir==DIR_DOWN){ hitboxX = this->X+this->TileWidth*8-8; hitboxY = this->Y; } else if(dir==DIR_LEFT){ hitboxX = this->X+this->TileWidth*16-16; hitboxY = this->Y+this->TileHeight*8-8; } else if(dir==DIR_RIGHT){ hitboxX = this->X; hitboxY = this->Y+this->TileHeight*8-8; } for(int i=Screen->NumLWeapons(); i>=1; i--){ lweapon l = Screen->LoadLWeapon(i); if(l->CollDetection&&l->DeadState==WDS_ALIVE){ if(l->ID==LW_BOMBBLAST||l->ID==LW_SBOMBBLAST){ if(RectCollision(l->X+l->HitXOffset, l->Y+l->HitYOffset, l->X+l->HitXOffset+l->HitWidth-1, l->Y+l->HitYOffset+l->HitHeight-1, hitboxX, hitboxY, hitboxX+15, hitboxY+15)){ return true; } } if(l->ID == LW_ARROW && G[G_GLOBALFRAMES] % 8 == 0){ if(dir == DIR_UP){ if(Distance(l->X, l->Y, this->X+8, this->Y+16) <20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+8, this->Y+16); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } if(dir == DIR_DOWN){ if(Distance(l->X, l->Y, this->X+8, this->Y) <20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+8, this->Y); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } if(dir == DIR_LEFT){ if(Distance(l->X, l->Y, this->X+16, this->Y) <20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+16, this->Y); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } if(dir == DIR_RIGHT){ if(Distance(l->X, l->Y, this->X, this->Y) <20){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X, this->Y); l2->UseSprite(148); l2->DeadState = l2->NumFrames*l2->ASpeed; } } } } } return false; } bool BombWall_CheckD(int dir, int id){ if(id>0) return Screen->D[D_LTTPDOORID]&(1<<(Clamp(id-1, 0, 15))); else return Screen->D[D_LTTPDOORS]&(1<<(8+Clamp(dir, 0, 3))); } void BombWall_SetD(int dir, int id){ int offset; if(dir==DIR_UP) offset = -16; else if(dir==DIR_DOWN) offset = 16; else if(dir==DIR_LEFT) offset = -1; else offset = 1; int nextD; if(id>0){ Screen->D[D_LTTPDOORID] |= (1<<(Clamp(id-1, 0, 15))); nextD = Game->GetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORID); Game->SetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORID, nextD|(1<<(Clamp(id-1, 0, 15)))); } else{ Screen->D[D_LTTPDOORS] |= (1<<(8+Clamp(dir, 0, 3))); nextD = Game->GetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORS); Game->SetDMapScreenD(Game->GetCurDMap(), Game->GetCurDMapScreen()+offset, D_LTTPDOORS, nextD|(1<<(8+Clamp(OppositeDir(dir), 0, 3)))); } } //A shorthand way to set a combo on the current layer. //Layer 0 is the screen itself. void __SetLayerComboC(int layer, int pos, int cset) { if (layer == 0) Screen->ComboC[pos] = cset; else Game->SetComboCSet(Screen->LayerMap(layer), Screen->LayerScreen(layer), pos, cset); } } ffc script ArrowTrap{ void run(int dir, int speed, int type, int interval, int damage, int wait){ int counter; if(type == 1) counter = interval; if(wait > 0) Waitframes(wait); while(true){ if(type == 0){ if(counter>0) counter--; if((((dir == DIR_UP || dir == DIR_DOWN) && Link->X >= this->X-8 && Link->X <= this->X+8) || ((dir == DIR_LEFT || dir == DIR_RIGHT) && Link->Y >= this->Y-8 && Link->Y <= this->Y+8)) && counter == 0){ eweapon e = FireEWeapon(EW_ARROW, this->X + RussInFrontX(dir, -8) + 4, this->Y + RussInFrontY(dir, -8), DegtoRad(DirAngle(dir)), speed, damage, -1, 1, EWF_ROTATE); counter = interval; } } else if(type == 1){ if(counter>0) counter--; else{ eweapon e = FireEWeapon(EW_ARROW, this->X + RussInFrontX(dir, -8) + 4, this->Y + RussInFrontY(dir, -8), DegtoRad(DirAngle(dir)), speed, damage, -1, 1, EWF_ROTATE); counter = interval; } } else if(type>= 2){ if(counter>0) counter--; else if(Screen->NumNPCs() > 0){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == type) eweapon e = FireEWeapon(EW_ARROW, ComboX(i) + RussInFrontX(dir, -8) + 4, ComboY(i) + RussInFrontY(dir, -8), DegtoRad(DirAngle(dir)), speed, damage, -1, 1, EWF_ROTATE); } counter = interval; } } Waitframe(); } } } ffc script PatreEye{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_KNOCKBACK); Ghost_SetFlag(GHF_FLYING_ENEMY); // Ghost_SetFlag(GHF_4WAY); // Ghost_SetFlag(GHF_SET_DIRECTION); Ghost_SetFlag(GHF_IGNORE_NO_ENEMY); int Combo = ghost->Attributes[10]; Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1); int Counter = 0; int ACounter = 0; // Ghost_SetHitOffsets(ghost, 0, 0, 8, 8); while(true){ Counter = Ghost_ConstantWalk8(Counter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger); ACounter++; if(ACounter>=180){ for(int i=-1; i<=1; i++){ eweapon e = FireAimedEWeapon(EW_BEAM, Ghost_X+8, Ghost_Y, DegtoRad(30*i), 200, ghost->WeaponDamage, 39, 13, EWF_ROTATE_360); } for(int i = 0; i<30; i++){ Screen->FastTile(2, Ghost_X, Ghost_Y+16, 27401, 7, OP_OPAQUE); Ghost_Waitframe(this, ghost, true, true); } ACounter = 0; } Screen->FastTile(2, Ghost_X, Ghost_Y+16, 27401, 7, OP_OPAQUE); Ghost_Waitframe(this, ghost, true, true); } } } ffc script IceBlock{ lweapon CreateHitbox(ffc this){ lweapon hitbox = CreateLWeaponAt(LW_REFROCK, this->X, this->Y); hitbox->Misc[0] = 1; hitbox->Damage = 200; hitbox->UseSprite(129); return hitbox; } void UpdateHitbox(ffc this, lweapon l){ l->X = this->X; l->Y = this->Y; } void run(){ int Data = this->Data; int UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; int UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; int PushCounter = 8; int PushDir; int MaxPush = 3; lweapon hitbox; while(true){ for(int i = Screen->NumLWeapons(); i>0; i--){ lweapon l = Screen->LoadLWeapon(i); if((l->ID == LW_FIRE || l->ID == LW_BEAM) && Collision(this, l)){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+Rand(-8, 8), this->Y+Rand(-8, 8)); l2->UseSprite(115); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; Game->PlaySound(66); this->Data = 0; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; Quit(); } } if(Link->X>=this->X-16&&Link->X<=this->X-8&&Abs(Link->Y-this->Y) <=4&&Link->InputRight){ PushDir = DIR_RIGHT; PushCounter--; } else if(Link->X<=this->X+16&&Link->X>=this->X+8&&Abs(Link->Y-this->Y) <=4&&Link->InputLeft){ PushDir = DIR_LEFT; PushCounter--; } else if(Link->Y<=this->Y+16&&Link->Y>=this->Y+8&&Abs(Link->X-this->X) <=4&&Link->InputUp){ PushDir = DIR_UP; PushCounter--; } else if(Link->Y>=this->Y-16&&Link->Y<=this->Y-8&&Abs(Link->X-this->X) <=4&&Link->InputDown){ PushDir = DIR_DOWN; PushCounter--; } else{ PushCounter = 8; } if(PushCounter<=0){ if(PushDir==DIR_RIGHT&&CanWalkIceBlock(this->X, this->Y, DIR_RIGHT, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->X++; PushCounter = 0; while(CanWalkIceBlock(this->X, this->Y, DIR_RIGHT, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; hitbox = CreateHitbox(this); for(int i=0; i<8; i++){ this->X += 2; if(hitbox->isValid()) UpdateHitbox(this, hitbox); else hitbox = CreateHitbox(this); Waitframe(); } Remove(hitbox); UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; } MaxPush--; if(MaxPush == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+Rand(-8, 8), this->Y+Rand(-8, 8)); l2->UseSprite(115); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; Game->PlaySound(66); this->Data = 0; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; Quit(); } } else if(PushDir==DIR_LEFT&&CanWalkIceBlock(this->X, this->Y, DIR_LEFT, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->X--; PushCounter = 0; while(CanWalkIceBlock(this->X, this->Y, DIR_LEFT, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; hitbox = CreateHitbox(this); for(int i=0; i<8; i++){ this->X -= 2; if(hitbox->isValid()) UpdateHitbox(this, hitbox); else hitbox = CreateHitbox(this); Waitframe(); } Remove(hitbox); UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; } MaxPush--; if(MaxPush == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+Rand(-8, 8), this->Y+Rand(-8, 8)); l2->UseSprite(115); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; Game->PlaySound(66); this->Data = 0; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; Quit(); } } else if(PushDir==DIR_UP&&CanWalkIceBlock(this->X, this->Y, DIR_UP, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->Y--; PushCounter = 0; while(CanWalkIceBlock(this->X, this->Y, DIR_UP, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; hitbox = CreateHitbox(this); for(int i=0; i<8; i++){ this->Y -= 2; if(hitbox->isValid()) UpdateHitbox(this, hitbox); else hitbox = CreateHitbox(this); Waitframe(); } Remove(hitbox); UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; } MaxPush--; if(MaxPush == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+Rand(-8, 8), this->Y+Rand(-8, 8)); l2->UseSprite(115); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; Game->PlaySound(66); this->Data = 0; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; Quit(); } } else if(PushDir==DIR_DOWN&&CanWalkIceBlock(this->X, this->Y, DIR_DOWN, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->Y++; PushCounter = 0; while(CanWalkIceBlock(this->X, this->Y, DIR_DOWN, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; hitbox = CreateHitbox(this); for(int i=0; i<8; i++){ this->Y += 2; if(hitbox->isValid()) UpdateHitbox(this, hitbox); else hitbox = CreateHitbox(this); Waitframe(); } Remove(hitbox); UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; } MaxPush--; if(MaxPush == 0){ lweapon l2 = CreateLWeaponAt(LW_SCRIPT10, this->X+Rand(-8, 8), this->Y+Rand(-8, 8)); l2->UseSprite(115); l2->Misc[CLW_TIMER] = l2->NumFrames*l2->ASpeed; l2->CollDetection = false; Game->PlaySound(66); this->Data = 0; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; Quit(); } } } if(Screen->ComboD[ComboAt(this->X+8, this->Y+8)]!=Data){ this->Data = 0; Quit(); } Waitframe(); } } } bool CanWalkIceBlock(int x, int y, int dir, int step, bool full_tile) { int c=8; int xx = x+15; int yy = y+15; if(full_tile) c=0; if(dir==0) return !(y-step<0||Screen->isSolid(x,y+c-step)||Screen->isSolid(x+8,y+c-step)||Screen->isSolid(xx,y+c-step)||Screen->ComboF[ComboAt(x,y+c-step)] == 67); else if(dir==1) return !(yy+step>=176||Screen->isSolid(x,yy+step)||Screen->isSolid(x+8,yy+step)||Screen->isSolid(xx,yy+step)||Screen->ComboF[ComboAt(x,yy+step)] == 67); else if(dir==2) return !(x-step<0||Screen->isSolid(x-step,y+c)||Screen->isSolid(x-step,y+c+7)||Screen->isSolid(x-step,yy)||Screen->ComboF[ComboAt(x-step,y+c)] == 67); else if(dir==3) return !(xx+step>=256||Screen->isSolid(xx+step,y+c)||Screen->isSolid(xx+step,y+c+7)||Screen->isSolid(xx+step,yy)||Screen->ComboF[ComboAt(xx+step,y+c)] == 67); return false; //invalid direction } ffc script Roadblock{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); int Combo = ghost->Attributes[10]; Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1); int dir; while(true){ dir = AngleDir4(Angle(Link->X, Link->Y,Ghost_X, Ghost_Y)); if(Shutter_LinkCollide(this, dir, Link->X, Link->Y, true)) Shutter_EjectLink(this, dir); Ghost_Waitframe(this, ghost, true, true); } } } ffc script PushBlock{ void run(){ int Data = this->Data; int UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; int UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; int PushCounter = 8; int PushDir; int Cooldown; while(true){ if(Screen->ComboT[ComboAt(this->X+8, this->Y+8)] == CT_LADDERHOOKSHOT){ Game->PlaySound(38); lweapon l = CreateLWeaponAt(LW_SCRIPT10, this->X, this->Y); l->UseSprite(138); l->DeadState = l->NumFrames*l->ASpeed; // Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; this->Data = 0; } if(Link->X>=this->X-16&&Link->X<=this->X-8&&Abs(Link->Y-this->Y) <=4&&Link->InputRight&&Cooldown==0){ PushDir = DIR_RIGHT; PushCounter--; } else if(Link->X<=this->X+16&&Link->X>=this->X+8&&Abs(Link->Y-this->Y) <=4&&Link->InputLeft&&Cooldown==0){ PushDir = DIR_LEFT; PushCounter--; } else if(Link->Y<=this->Y+16&&Link->Y>=this->Y+8&&Abs(Link->X-this->X) <=4&&Link->InputUp&&Cooldown==0){ PushDir = DIR_UP; PushCounter--; } else if(Link->Y>=this->Y-16&&Link->Y<=this->Y-8&&Abs(Link->X-this->X) <=4&&Link->InputDown&&Cooldown==0){ PushDir = DIR_DOWN; PushCounter--; } else{ PushCounter = 8; } if(PushCounter<=0){ if(PushDir==DIR_RIGHT&&CanWalkBlock(this->X, this->Y, DIR_RIGHT, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->X++; PushCounter = 0; // while(CanWalk(this->X, this->Y, DIR_RIGHT, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; for(int i=0; i<8; i++){ this->X += 2; Waitframe(); } UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; // } Cooldown = 12; } else if(PushDir==DIR_LEFT&&CanWalkBlock(this->X, this->Y, DIR_LEFT, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->X--; PushCounter = 0; // while(CanWalk(this->X, this->Y, DIR_LEFT, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; for(int i=0; i<8; i++){ this->X -= 2; Waitframe(); } UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; // } Cooldown = 12; } else if(PushDir==DIR_UP&&CanWalkBlock(this->X, this->Y, DIR_UP, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->Y--; PushCounter = 0; // while(CanWalk(this->X, this->Y, DIR_UP, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; for(int i=0; i<8; i++){ this->Y -= 2; Waitframe(); } UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; // } Cooldown = 12; } else if(PushDir==DIR_DOWN&&CanWalkBlock(this->X, this->Y, DIR_DOWN, 1, true)){ Game->PlaySound(SFX_PUSHBLOCK); Link->Y++; PushCounter = 0; // while(CanWalk(this->X, this->Y, DIR_DOWN, 1, true)){ this->Data = Data; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = UC; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = UCC; for(int i=0; i<8; i++){ this->Y += 2; Waitframe(); } UC = Screen->ComboD[ComboAt(this->X+8, this->Y+8)]; UCC = Screen->ComboC[ComboAt(this->X+8, this->Y+8)]; // this->Data = GH_INVISIBLE_COMBO; Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = Data; Screen->ComboC[ComboAt(this->X+8, this->Y+8)] = this->CSet; // } Cooldown = 12; } } if(Screen->ComboD[ComboAt(this->X+8, this->Y+8)]!=Data){ this->Data = 0; Quit(); } if(Cooldown>0) Cooldown--; Waitframe(); } } } bool CanWalkBlock(int x, int y, int dir, int step, bool full_tile) { int c=8; int xx = x+15; int yy = y+15; if(full_tile) c=0; if(dir==0) return !(y-step<0||Screen->isSolid(x,y+c-step)||Screen->isSolid(x+8,y+c-step)||Screen->isSolid(xx,y+c-step)||Screen->ComboF[ComboAt(x,y+c-step)]==67); else if(dir==1) return !(yy+step>=176||Screen->isSolid(x,yy+step)||Screen->isSolid(x+8,yy+step)||Screen->isSolid(xx,yy+step)||Screen->ComboF[ComboAt(x,yy+step)]==67); else if(dir==2) return !(x-step<0||Screen->isSolid(x-step,y+c)||Screen->isSolid(x-step,y+c+7)||Screen->isSolid(x-step,yy)||Screen->ComboF[ComboAt(x-step,y+c)]==67); else if(dir==3) return !(xx+step>=256||Screen->isSolid(xx+step,y+c)||Screen->isSolid(xx+step,y+c+7)||Screen->isSolid(xx+step,yy)||Screen->ComboF[ComboAt(xx+step,y+c)]==67); return false; //invalid direction } ffc script Level7Puzzle{ void run(int flag){ if(Screen->State[ST_BOSSCHEST]) Screen->TriggerSecrets(); int ComboTracker[176]; int ComboGoals[176]; int ComboPlus = 4908; int ComboEx = 4909; int ComboCrossUp = 4912; int ComboCrossDown = 4913; int ComboCrossLeft = 4915; int ComboCrossRight = 4914; int ComboArmosPlus = 4938; int ComboArmosEx = 4942; int ComboArmosCross = 4946; int Loc; for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == flag) ComboGoals[i] = 1; if(Screen->ComboF[i] == flag+1) ComboGoals[i] = 2; } while(true){ for(int i = 0; i<176; i++){ ComboTracker[i] = 0; } while(Distance(Link->X, Link->Y, this->X, this->Y) > 4) Waitframe(); this->Data++; for(int i = 1; i<=32; i++){ ffc f = Screen->LoadFFC(i); if((f->Script == 43 || f->Script == 11) && f->Data != 0){ Loc = ComboAt(f->X, f->Y); if(f->Data == ComboPlus || f->Data == ComboCrossUp || f->Data == ComboCrossDown || f->Data == ComboCrossLeft || f->Data == ComboCrossRight || f->Data == ComboArmosPlus || f->Data == ComboArmosPlus+1 || f->Data == ComboArmosCross || f->Data == ComboArmosCross+1){ ComboTracker[Loc]++; ComboTracker[Loc-16]++; ComboTracker[Loc+16]++; ComboTracker[Loc-1]++; ComboTracker[Loc+1]++; } if(f->Data == ComboCrossUp || f->Data == ComboArmosCross || f->Data == ComboArmosCross+1) ComboTracker[Loc+32]++; if(f->Data == ComboCrossDown) ComboTracker[Loc-32]++; if(f->Data == ComboCrossLeft) ComboTracker[Loc+2]++; if(f->Data == ComboCrossRight) ComboTracker[Loc-2]++; if(f->Data == ComboEx || f->Data == ComboArmosEx || f->Data == ComboArmosEx+1){ ComboTracker[Loc]++; ComboTracker[Loc-17]++; ComboTracker[Loc-15]++; ComboTracker[Loc+15]++; ComboTracker[Loc+17]++; } } } for(int i = 0; i<176; i++){ if((ComboTracker[i] + 1) % 2 == 0){ lweapon Fire = CreateLWeaponAt(LW_FIRE, ComboX(i), ComboY(i)); Fire->Damage = 3*G[G_WEAPON_MULTIPLIER]; Fire->UseSprite(12); Fire->Dir = Link->Dir; Fire->Misc[1] = 1; Fire->Step = 0; Game->PlaySound(13); } else if(ComboTracker[i] % 2 == 0 && ComboTracker[i] != 0){ lweapon Fire = CreateLWeaponAt(LW_FIRE, ComboX(i), ComboY(i)); Fire->Damage = 3*G[G_WEAPON_MULTIPLIER]; Fire->UseSprite(41); Fire->Dir = Link->Dir; Fire->Misc[1] = 1; Fire->Step = 0; Game->PlaySound(13); } } bool loseflag; for(int i = 0; i<176; i++){ if(ComboGoals[i] == 1){ if((ComboTracker[i] + 1) % 2 != 0){ loseflag = true; break; } } if(ComboGoals[i] == 2){ if((ComboTracker[i] + 1) % 2 == 0){ loseflag = true; break; } } } if(!loseflag){ Game->PlaySound(27); Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; Screen->State[ST_BOSSCHEST] = true; //Cuz NES dugneons suck } while(Distance(Link->X, Link->Y, this->X, this->Y) <= 4) Waitframe(); this->Data--; } } } ffc script ShadowCopy{ void run(int delay, int damage){ int LinkX[500]; int LinkY[500]; int LinkTile[500]; int delaycounter; while(true){ for(int i = 499; i>0; i--){ LinkX[i] = LinkX[i-1]; LinkY[i] = LinkY[i-1]; LinkTile[i] = LinkTile[i-1]; } LinkX[0] = Link->X; LinkY[0] = Link->Y; LinkTile[0] = Link->Tile; if(G[G_INVISIBLE] == 1){ if(Link->Item[RING_RIGGS]) LinkTile[0] = 30504 + Link->Dir; else LinkTile[0] = 30500 + Link->Dir; } if(delaycounter < delay){ Screen->FastCombo(2, LinkX[delaycounter], LinkY[delaycounter], 4916, 4, OP_OPAQUE); delaycounter++; } else{ Screen->FastTile(2, LinkX[delaycounter], LinkY[delaycounter], LinkTile[delaycounter], 4, OP_OPAQUE); eweapon e = FireAimedEWeapon(EW_SCRIPT2, LinkX[delaycounter], LinkY[delaycounter], 0, 0, damage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } Waitframe(); } } } ffc script BetterBar{ void run(int angle, int speed, int numarms, int numsegments, int damage, int combo, int cset, int specialflag){ npc n; if(specialflag > 0){ Waitframes(8); if(Screen->NumNPCs() >= specialflag) n = Screen->LoadNPC(specialflag); } int SegmentsX[100]; int SegmentsY[100]; if(numarms == 0) numarms = 1; if(numsegments == 0) numsegments = 1; while(true){ speed = this->InitD[1]; // if(Screen->D[0] == 1) // speed *= -1; for(int i = 0; i < numarms; i++){ for(int j = 0; j < numsegments; j++){ SegmentsX[i*numsegments+j] = this->X+VectorX(j*16, angle+(360/numarms)*i); SegmentsY[i*numsegments+j] = this->Y+VectorY(j*16, angle+(360/numarms)*i); } } angle += speed; if(specialflag > 0){ if(!n->isValid()) Quit(); else{ this->X = n->X; this->Y = n->Y; } } MaintenanceWaitframe(SegmentsX, SegmentsY, combo, cset, damage); } } void MaintenanceWaitframe(int SegmentsX, int SegmentsY, int combo, int cset, int damage){ int layer = 4; for(int i = 0; i < SizeOfArray(SegmentsX); i++){ if(!(SegmentsX[i] == 0 && SegmentsY[i] == 0)){ Screen->FastCombo(layer, SegmentsX[i], SegmentsY[i], combo, cset, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 6, SegmentsX[i]+8, SegmentsY[i]+8, 8)) DamageLink(damage); } } Waitframe(); } } ffc script FireryBoneFish{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this, enemyID); int originaldata = Ghost_Data; Ghost_Data = 1; Ghost_Waitframes(this, ghost, true, true,8); Ghost_Data = originaldata; Ghost_SetFlag(GHF_NORMAL); Ghost_SetFlag(GHF_8WAY); Ghost_UnsetFlag(GHF_KNOCKBACK); Ghost_SetFlag(GHF_FLYING_ENEMY); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); int walkcounter = -1; int firetimer = Rand(180, 300); while(true){ walkcounter = Ghost_VariableWalk8(walkcounter, ghost->Step, ghost->Haltrate, ghost->Homing, ghost->Hunger, 8); firetimer--; if(firetimer == 0){ FireAimedEWeapon(EW_FIREBALL, Ghost_X, Ghost_Y, 0, 150, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); firetimer = Rand(180, 300); } Screen->FastTile(2, Ghost_X, Ghost_Y+16, 27401, 7, OP_OPAQUE); Ghost_Waitframe(this, ghost, true, true); } } } ffc script MultiSwitchSecret{ void run(int Dregister, int totalnum, int temp){ bool breakflag; for(int i = 0; iD[i] == 0){ breakflag = true; break; } } if(!breakflag){ Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; this->Data++; Quit(); } else if(temp == 1){ for(int i = 0; iD[i] = 0; } } if(Screen->D[Dregister] == 1){ this->Data++; Quit(); } while(Distance(Link->X, Link->Y, this->X, this->Y) > 4) Waitframe(); Screen->D[Dregister] = 1; this->Data++; breakflag = false; for(int i = 0; iD[i] == 0){ breakflag = true; break; } } if(!breakflag){ Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; Quit(); } } } ffc script LostHills{ void run(int screen){ if(screen == 1){ //The magic happens here int RockX[10]; int RockY[10]; bool failure; for(int i = 1; i<=10; i++){ ffc f = Screen->LoadFFC(i); RockX[i-1] = f->X; RockY[i-1] = f->Y; } while(RockX[9] != 176 && RockY[9] != 64){ for(int i = 1; i<=10; i++){ ffc f = Screen->LoadFFC(i); if(i != 10 && (f->X != RockX[i-1] || f->Y != RockY[i-1])) failure = true; RockX[i-1] = f->X; RockY[i-1] = f->Y; } MapWaitframe(); } if(failure){ while(true) MapWaitframe(); } while(true){ for(int i = 1; i<=10; i++){ ffc f = Screen->LoadFFC(i); if(i != 10 && (f->X != RockX[i-1] || f->Y != RockY[i-1])) failure = true; RockX[i-1] = f->X; RockY[i-1] = f->Y; } if(Distance(Link->X, Link->Y, 144, 80) <= 8 && Link->Dir == DIR_UP && ((G[G_LINK_EQUIPA] == 13 && Link->PressA) || (G[G_LINK_EQUIPB] == 13 && Link->PressB) || (G[G_LINK_EQUIPL] == 13 && Link->PressL) || (G[G_LINK_EQUIPR] == 13 && Link->PressR) || (G[G_LINK_EQUIPA] == 221 && Link->PressA) || (G[G_LINK_EQUIPB] == 221 && Link->PressB) || (G[G_LINK_EQUIPL] == 221 && Link->PressL) || (G[G_LINK_EQUIPR] == 221 && Link->PressR))){ Game->PlaySound(7); break; } MapWaitframe(); } if(failure){ while(true) MapWaitframe(); } while(!(RockX[9] == 192 && RockY[9] == 80)){ for(int i = 1; i<=10; i++){ ffc f = Screen->LoadFFC(i); if(i != 10 && (f->X != RockX[i-1] || f->Y != RockY[i-1])) failure = true; RockX[i-1] = f->X; RockY[i-1] = f->Y; } MapWaitframe(); } if(failure){ while(true) MapWaitframe(); } while(!(RockX[2] == 144 && RockY[2] == 80)){ for(int i = 1; i<=10; i++){ ffc f = Screen->LoadFFC(i); if(i != 3 && (f->X != RockX[i-1] || f->Y != RockY[i-1])) failure = true; RockX[i-1] = f->X; RockY[i-1] = f->Y; } MapWaitframe(); } if(failure){ while(true) MapWaitframe(); } Screen->SetSideWarp(0, 0x76, 28, WT_SCROLLING); while(true) MapWaitframe(); } else if(screen == 2){ if(G[G_RANDO] == 1 && G[G_TABLETRANDO] == 1) Screen->SetSideWarp(0, 0x0B, 0, WT_SCROLLING); } else if(screen == 3){ if(G[G_RANDO] == 1 && G[G_TABLETRANDO] == 1){ int count; for(int i = G_TABLETSTART; i<=G_TABLETSTART+5; i++){ if(G[i] == 1) count++; } int Slash[] = "/"; int X = 144; int Y = 22; if(count<6){ Screen->ComboD[ComboAt(144, 32)] = 2517; Screen->ComboC[ComboAt(144, 32)] = 11; } while(true){ Screen->FastTile(2, X-14, Y-6, 23121, 8, OP_OPAQUE); Screen->DrawString(6, X+5, Y, FONT_Z3SMALL, 0x01, 0x00, TF_NORMAL, Slash, OP_OPAQUE); Screen->DrawInteger(6, X, Y, FONT_Z3SMALL,0x01, 0x00,-1, -1, count, 0, OP_OPAQUE); Screen->DrawInteger(6, X+10, Y, FONT_Z3SMALL,0x01, 0x00,-1, -1, 6, 0, OP_OPAQUE); Waitframe(); } } } else{ while(true) MapWaitframe(); } } void MapWaitframe(){ int x = 61; int y = -36; Screen->PutPixel(7, x, y, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x+1, y, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x, y+1, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x+1, y+1, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x+1, y+2, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x+2, y+1, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x+2, y+2, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x, y+2, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, x+2, y, 0x8C, 0, 0, 0, OP_OPAQUE); Waitframe(); } } void PixelTest(){ if(Link->InputEx3) G[G_TESTX]--; if(Link->InputEx4) G[G_TESTX]++; if(Link->InputEx1) G[G_TESTY]--; if(Link->InputEx2) G[G_TESTY]++; TraceToScreen(0, G[G_TESTX]); TraceToScreen(16, G[G_TESTY]); Screen->PutPixel(7, G[G_TESTX], G[G_TESTY], 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX]+1, G[G_TESTY], 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX], G[G_TESTY]+1, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX]+1, G[G_TESTY]+1, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX]+1, G[G_TESTY]+2, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX]+2, G[G_TESTY]+1, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX]+2, G[G_TESTY]+2, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX], G[G_TESTY]+2, 0x8C, 0, 0, 0, OP_OPAQUE); Screen->PutPixel(7, G[G_TESTX]+2, G[G_TESTY], 0x8C, 0, 0, 0, OP_OPAQUE); } const int ITEM_TABLETMAP = 210; void TabletDraw(){ if(Link->Item[ITEM_TABLETMAP]){ if(Game->GetCurMap() == 28){ if(G[G_TABLETSTART + 0] == 0){ //Great Chasm Screen->FastTile(7, 50, -32, 6, 0, OP_OPAQUE); //49, -32 } if(G[G_TABLETSTART + 1] == 0){ //South of monument cavern Screen->FastTile(7, 69, -14, 6, 0, OP_OPAQUE); //65, -12 } if(G[G_TABLETSTART + 2] == 0){ //Lynel Swarm Screen->FastTile(7, 69, -42, 6, 0, OP_OPAQUE); //69, -40 } if(G[G_TABLETSTART + 3] == 0){ //Death Mountain Screen->FastTile(7, 30, -41, 6, 0, OP_OPAQUE); //33, -40 } } if(Game->GetCurMap() == 4){ if(G[G_TABLETSTART + 4] == 0){ //Pacific Cliffs Screen->FastTile(7, 77, -42, 6, 0, OP_OPAQUE); //69, -40 } if(G[G_TABLETSTART + 5] == 0){ //Tierra del Fuego Screen->FastTile(7, 17, -42, 6, 0, OP_OPAQUE); //17, -40 } } } } const int C_L8WARPPAD1 = 0x71; const int C_L8WARPPAD2 = 0x72; const int C_L8WARPPAD3 = 0x73; const int SFX_L8WARP1 = 35; const int SFX_L8WARP2 = 60; const int CMB_AUTOWARPA = 1264; //D0: Warp return to use 0-3. If -1, make Link jump out of a pit if he spawns on this FFC //D1: X position to jump to if D0 is -1 //D2: Y position to jump to if D0 is -1 ffc script L8WarpPad{ void run(int whichWarp, int tX, int tY){ int i; int j; int k; int x; int y; int dist; int angle; if(whichWarp>-1){ while(Abs(Link->X-this->X)<8&&Abs(Link->Y-this->Y)<8){ Waitframe(); } while(true){ if(Abs(Link->X-this->X)<=8&&Abs(Link->Y-this->Y)<=8){ if(Abs(Link->X-this->X)) Link->X += Sign(this->X-Link->X); if(Abs(Link->Y-this->Y)) Link->Y += Sign(this->Y-Link->Y); if(Link->X==this->X&&Link->Y==this->Y){ break; } } Waitframe(); } this->Data++; Link->Invisible = true; Link->CollDetection = false; Game->PlaySound(SFX_L8WARP1); for(i=40; i>=0; i--){ G[G_INVISIBLE] = 1; j = 2+8*(i/40); x = Link->X+8+Rand(-j, j); y = Link->Y+8+Rand(-j, j); k = 8+16*(i/40); Screen->Circle(4, x, y, k, C_L8WARPPAD1, 1, 0, 0, 0, true, 128); Screen->Circle(4, x+Rand(-j*0.2, j*0.2), y+Rand(-j*0.2, j*0.2), k*0.9, C_L8WARPPAD2, 1, 0, 0, 0, true, 128); Screen->Circle(4, x+Rand(-j*0.1, j*0.1), y+Rand(-j*0.1, j*0.1), k*0.8, C_L8WARPPAD3, 1, 0, 0, 0, true, 128); WaitNoAction(); } x = Link->X; y = Link->Y; Game->PlaySound(SFX_L8WARP2); for(i=0; i<40; i++){ G[G_INVISIBLE] = 1; if(i<10){ k = 128; if(i>=6) k = 64; for(j=0; j<8; j++){ Screen->Ellipse(2, x+8, y+8, (i*4+j)*2, (i*4+j), C_L8WARPPAD1, 1, 0, 0, 0, false, k); } } Screen->Ellipse(4, x+8, y+8-6*i, (12-6*(i/40)), (16+64*(i/40)), C_L8WARPPAD1, 1, 0, 0, 0, true, 128); Screen->Ellipse(4, x+8, y+8-7*i, (12-6*(i/40))*0.9, (16+64*(i/40))*0.9, C_L8WARPPAD2, 1, 0, 0, 0, true, 128); Screen->Ellipse(4, x+8, y+8-8*i, (12-6*(i/40))*0.8, (16+64*(i/40))*0.8, C_L8WARPPAD3, 1, 0, 0, 0, true, 128); WaitNoAction(); } Link->Invisible = false; Link->CollDetection = true; if(G[G_TOWERSCENESTART + Game->GetCurDMap() - 29] == 0) this->Data = CMB_AUTOWARPA + 1; else this->Data = CMB_AUTOWARPA; } else{ if(Distance(Link->X, Link->Y, this->X, this->Y)<8){ Link->Jump = FindJumpLength(40, true); x = Link->X; y = Link->Y; Link->CollDetection = false; dist = Distance(x, y, tX, tY); angle = Angle(x, y, tX, tY); for(i=0; i<40; i++){ Link->X = x+VectorX(dist/40*i, angle); Link->Y = y+VectorY(dist/40*i, angle); Link->Dir = AngleDir4(angle); WaitNoAction(); } Link->X = tX; Link->Y = tY; Link->CollDetection = true; } } } } int FindJumpLength(int jumpInput, bool inputFrames){ //Big ol table of rough jump values and their durations int jumpTBL[] = { 0.0, 0, 0.1, 3, 0.2, 4, 0.3, 5, 0.4, 6, 0.5, 8, 0.6, 9, 0.7, 10, 0.8, 11, 0.9, 13, 1.0, 14, 1.1, 15, 1.2, 16, 1.3, 18, 1.4, 19, 1.5, 20, 1.6, 21, 1.7, 23, 1.8, 24, 1.9, 25, 2.0, 26, 2.1, 28, 2.2, 29, 2.3, 30, 2.4, 31, 2.5, 33, 2.6, 34, 2.7, 35, 2.8, 36, 2.9, 38, 3.0, 39, 3.1, 40, 3.2, 41, 3.3, 43, 3.4, 44, 3.5, 45, 3.6, 47, 3.7, 48, 3.8, 49, 3.9, 51, 4.0, 52, 4.1, 54, 4.2, 55, 4.3, 57, 4.4, 58, 4.5, 60, 4.6, 61, 4.7, 63, 4.8, 64, 4.9, 66, 5.0, 67, 5.1, 69, 5.2, 71, 5.3, 72, 5.4, 74, 5.5, 76, 5.6, 77, 5.7, 79, 5.8, 81, 5.9, 83, 6.0, 85, 6.1, 86, 6.2, 88, 6.3, 90, 6.4, 92, 6.5, 94, 6.6, 96, 6.7, 98, 6.8, 100, 6.9, 102, 7.0, 104, 7.1, 106, 7.2, 108, 7.3, 110, 7.4, 112, 7.5, 114, 7.6, 116, 7.7, 118, 7.8, 120, 7.9, 123, 8.0, 125, 8.1, 127, 8.2, 129, 8.3, 131, 8.4, 134, 8.5, 136, 8.6, 138, 8.7, 141, 8.8, 143, 8.9, 145, 9.0, 148, 9.1, 150, 9.2, 153, 9.3, 155, 9.4, 158, 9.5, 160, 9.6, 162, 9.7, 165, 9.8, 168, 9.9, 170, 10.0, 173 }; //When getting a duration from a jump if(!inputFrames){ //Keep values between 0 and 10, nothing beyond that would be sensible in most cases jumpInput = Clamp(jumpInput, 0, 10); //Round to the nearest 0.1 jumpInput *= 10; jumpInput = Round(jumpInput); jumpInput *= 0.1; return jumpTBL[jumpInput*2+1]; } //When getting a jump from a duration else{ int closestIndex = 0; int closest = 0; //Cycle through the table to find the closest duration to the desired one for(int i=1; i<100; i++){ if(Abs(jumpTBL[i*2+1]-jumpInput)0){ Timer--; if(Timer == 90 || Timer == 60 || Timer == 30) Game->PlaySound(62); else if(Timer == 0){ Timer = MaxTime; Game->PlaySound(18); State++; if(State == 4) State = 0; for(int i = 0; i<176; i++){ for(int j = 0; j<4; j++){ if(Screen->ComboD[i] == Damage[j]) Screen->ComboD[i] = Safe[j]; } if(Screen->ComboD[i] == Safe[State]) Screen->ComboD[i] = Damage[State]; if(Screen->ComboD[i] == Torches[State]){ this->X = ComboX(i); this->Y = ComboY(i); } } } } Waitframe(); } } } bool CanSwim(int x, int y, int dir, int step, bool full_tile) { int c=8; int xx = x+15; int yy = y+15; if(full_tile) c=0; if(dir==0) return !(y-step<0||Screen->ComboT[ComboAt(x,y+c-step)]==CT_WATER||Screen->ComboT[ComboAt(x+8,y+c-step)]==CT_WATER||Screen->ComboT[ComboAt(xx,y+c-step)]==CT_WATER); else if(dir==1) return !(yy+step>=176||Screen->ComboT[ComboAt(x,yy+step)]==CT_WATER||Screen->ComboT[ComboAt(x+8,yy+step)]==CT_WATER||Screen->ComboT[ComboAt(xx,yy+step)]==CT_WATER); else if(dir==2) return !(x-step<0||Screen->ComboT[ComboAt(x-step,y+c)]==CT_WATER||Screen->ComboT[ComboAt(x-step,y+c+7)]==CT_WATER||Screen->ComboT[ComboAt(x-step,yy)]==CT_WATER); else if(dir==3) return !(xx+step>=256||Screen->ComboT[ComboAt(xx+step,y+c)]==CT_WATER||Screen->ComboT[ComboAt(xx+step,y+c+7)]==CT_WATER||Screen->ComboT[ComboAt(xx+step,yy)]==CT_WATER); return false; //invalid direction } void LinkMovement_Update26th(){ __LinkMovement_UndoLinkMovementUpdate1(); if((Link->Action==LA_SWIMMING||Link->Action==LA_DIVING) && Game->GetCurDMap() == 15){ LinkMovement_AddLinkSpeedBoost(4); __LinkMovement_SpeedChangeSwimming(); // __LinkMovement_UpdatePushSwimming(LM_PUSHX2A, LM_PUSHY2A, false); // __LinkMovement_UpdatePushSwimming(LM_PUSHX2B, LM_PUSHY2B, true); __LinkMovement_UpdatePush(LM_PUSHX2A, LM_PUSHY2A, false); __LinkMovement_UpdatePush(LM_PUSHX2B, LM_PUSHY2B, true); } else{ __LinkMovement_SpeedChange(); __LinkMovement_UpdatePush(LM_PUSHX2A, LM_PUSHY2A, false); __LinkMovement_UpdatePush(LM_PUSHX2B, LM_PUSHY2B, true); } __LinkMovement_UndoLinkMovementUpdate2(); } const int RING_RIGGSSWIM = 214; void SwimDraw(){ if(Link->Action != LA_SCROLLING) G[G_LASTACTION] = Link->Action; if((Link->Action==LA_SWIMMING || Link->Action==LA_GOTHURTWATER || (Link->Action == LA_SCROLLING && (G[G_LASTACTION] == LA_SWIMMING || G[G_LASTACTION] == LA_DIVING))) && G[G_SWIMSCENE] == 1&& G[G_RIGGSJOINED] == 1 && ((Game->GetCurMap() == 4 && Game->GetCurDMap() != 17 && Game->GetCurScreen() != 0x77) || (Game->GetCurMap() == 11 && Game->GetCurScreen() == 0x6D))){ Link->Invisible = true; G[G_INVISIBLE] = 1; if(!Link->Item[RING_RIGGS] && !Link->Item[RING_RIGGSSWIM]) Link->Item[RING_RIGGSSWIM] = true; if(Link->Item[RING_RIGGS] && Link->Item[RING_RIGGSSWIM]) Link->Item[RING_RIGGSSWIM] = false; int CurrentFrame; if(G[G_SWIMFRAME] >= 28) G[G_SWIMFRAME] = 0; if(G[G_GLOBALFRAMES] % 2 == 0) G[G_SWIMFRAME]++; if(Link->Dir == DIR_UP) CurrentFrame = 30588; else if(Link->Dir == DIR_DOWN) CurrentFrame = 30585; else if(Link->Dir == DIR_LEFT) CurrentFrame = 30591; else if(Link->Dir == DIR_RIGHT) CurrentFrame = 30594; if((G[G_SWIMFRAME] >= 7 && G[G_SWIMFRAME] < 14) || G[G_SWIMFRAME] >=21) CurrentFrame++; Screen->DrawTile(2, ScrollingLinkX(), ScrollingLinkY()-16, CurrentFrame, 1, 2, 6, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } else if(Link->Action == LA_DIVING){ //Yay, nothing! } else{ if(Link->Item[RING_RIGGSSWIM]) Link->Item[RING_RIGGSSWIM] = false; } } //Function adds extra movement to Link's step speed void __LinkMovement_SpeedChangeSwimming(){ if(Link->Action==LA_SWIMMING||Link->Action==LA_DIVING){ if(LinkMovement[LM_STICKX]!=0||LinkMovement[LM_STICKY]!=0){ float movementSpeed = LinkMovement[LM_MOVEBOOST]; //We're calculating CanWalk for all directions in advance to hopefully save a bit on speed. bool CanWalk[4]; CanWalk[DIR_UP] = CanWalk(Link->X, Link->Y, DIR_UP, 1, false); CanWalk[DIR_DOWN] = CanWalk(Link->X, Link->Y, DIR_DOWN, 1, false); CanWalk[DIR_LEFT] = CanWalk(Link->X, Link->Y, DIR_LEFT, 1, false); CanWalk[DIR_RIGHT] = CanWalk(Link->X, Link->Y, DIR_RIGHT, 1, false); //If four way movement isn't on, Link's speed boost should be dampened for diagonals since he moves slower if(!FOUR_WAY_MOVEMENT){ if(LinkMovement[LM_STICKX]!=0&&LinkMovement[LM_STICKY]!=0){ //If he's pressing against a wall or in sideview, the speed dampening won't take effect if(CanWalk[Cond(LinkMovement[LM_STICKX]==-1, DIR_LEFT, DIR_RIGHT)] && CanWalk[Cond(LinkMovement[LM_STICKY]==-1, DIR_UP, DIR_DOWN)] && !IsSideview() ) movementSpeed = movementSpeed*0.7071; //Reduce movement speed at a diagonal } } //Otherwise, disable directions Link isn't facing else{ if(LinkMovement[LM_STICKX]!=0&&(Link->Dir==DIR_UP||Link->Dir==DIR_DOWN)){ CanWalk[DIR_LEFT] = false; CanWalk[DIR_RIGHT] = false; } if(LinkMovement[LM_STICKY]!=0&&(Link->Dir==DIR_LEFT||Link->Dir==DIR_RIGHT)){ CanWalk[DIR_UP] = false; CanWalk[DIR_DOWN] = false; } } //If there's a moving block in play, cancel the speed boost if Link is touching it if(Screen->MovingBlockX>-1){ //Predict where Link will move to so he doesn't clip into the block int projX = Link->X+movementSpeed*LinkMovement[LM_STICKX]; int projY = Link->Y+movementSpeed*LinkMovement[LM_STICKY]; if(RectCollision(projX, projY+8, projX+15, projY+15, Screen->MovingBlockX, Screen->MovingBlockY, Screen->MovingBlockX+15, Screen->MovingBlockY+15)){ LinkMovement[LM_MOVEBOOST] = 0; return; } } //This chunk is pretty much the same for both positive and negative movement speeds. //The only difference is that negative needs to check both opposing directions before adding the push. if(movementSpeed>0){ //Left if(LinkMovement[LM_STICKX]<0&&CanWalk[DIR_LEFT]) LinkMovement[LM_PUSHX2B] -= movementSpeed; //Right else if(LinkMovement[LM_STICKX]>0&&CanWalk[DIR_RIGHT]) LinkMovement[LM_PUSHX2B] += movementSpeed; //Up if(LinkMovement[LM_STICKY]<0&&CanWalk[DIR_UP]) LinkMovement[LM_PUSHY2B] -= movementSpeed; //Down else if(LinkMovement[LM_STICKY]>0&&CanWalk[DIR_DOWN]) LinkMovement[LM_PUSHY2B] += movementSpeed; } else if(movementSpeed<0){ //Left if(LinkMovement[LM_STICKX]<0&&CanWalk[DIR_LEFT]&&CanWalk[DIR_RIGHT]) LinkMovement[LM_PUSHX2B] -= movementSpeed; //Right else if(LinkMovement[LM_STICKX]>0&&CanWalk[DIR_LEFT]&&CanWalk[DIR_RIGHT]) LinkMovement[LM_PUSHX2B] += movementSpeed; //Up if(LinkMovement[LM_STICKY]<0&&CanWalk[DIR_UP]&&CanWalk[DIR_DOWN]) LinkMovement[LM_PUSHY2B] -= movementSpeed; //Down else if(LinkMovement[LM_STICKY]>0&&CanWalk[DIR_UP]&&CanWalk[DIR_DOWN]) LinkMovement[LM_PUSHY2B] += movementSpeed; } } } LinkMovement[LM_MOVEBOOST] = 0; //Movement boost gets reset at the end of every frame to prevent confusion //with what it's set to or what should turn it on/off } //Ever take a function Moosh called ugly and deformed and make it worse? //Empty, and become Russ bool __LinkMovement_CanSwim(int x, int y, int dir, int step, bool full_tile, bool noEdge) { int i; int xx; int yy; int xoffset = 0; int yoffset = 0; int width = 16; int height = 16; //Link's sideview hitbox is 8 pixels wide and centered on him if(IsSideview()&&(dir==DIR_UP||dir==DIR_DOWN)){ xoffset = 4; width = 8; } //If !full_tile, trim the top half off the hitbox else if(!full_tile){ yoffset = 8; height = 8; } if(dir==DIR_UP||dir==DIR_DOWN){ //Loop between three points of collision (two if sideview) for(i=0; i<=width-1; i=Min(i+8, width-1)){ if(dir==DIR_UP){ xx = x+xoffset+i; yy = y+yoffset-step; } else if(dir==DIR_DOWN){ xx = x+xoffset+i; yy = y+yoffset+height-1+step; } //If !noEdge, positions off the screen are considered solid if(xx<0||xx>255||yy<0||yy>175){ if(!noEdge) return false; } if(Screen->ComboT[ComboAt(xx, yy)] != CT_WATER) return false; if(i==width-1) break; } return true; } else if(dir==DIR_LEFT||dir==DIR_RIGHT){ //Loop between three points of collision (two if !full_tile) for(i=0; i<=height-1; i=Min(i+8, height-1)){ if(dir==DIR_LEFT){ xx = x+xoffset-step; yy = y+yoffset+i; } else if(dir==DIR_RIGHT){ xx = x+xoffset+width-1+step;; yy = y+yoffset+i; } //If !noEdge, positions off the screen are considered solid if(xx<0||xx>255||yy<0||yy>175){ if(!noEdge){ return false; } } if(Screen->ComboT[ComboAt(xx, yy)] != CT_WATER){ return false; } if(i==height-1) break; } return true; } return false; } void __LinkMovement_UpdatePushSwimming(int indexX, int indexY, bool noEdge){ int Imprecision = 0; //This is currently unused, but I guess I left it in in case I //ever see a reason to use it again...three cheers for bloat! //So what we have here is a series of for loops that run for as long as: // -The absolute value of the push array is greater than 0 // -Link isn't being blocked by a wall // -Link hasn't been moved the max number of pixels that frame //Any movement of less than a pixel is left over in the array and any time the function successfully moves Link, //the array counts back down towards 0. This way movements of less than a pixel can "add up" to a full pixel movement. //Left int MoveSpeed = 1; for(int i=0; iInputLeft; i++){ if(__LinkMovement_CanSwim(Link->X, Link->Y, DIR_LEFT, 1, false, noEdge)){ Link->X--; LinkMovement[indexX]++; } //This is unused, but would snap Link to the grid if he's close enough to aligned else if(Imprecision>0&&Abs(GridY(Link->Y+8)-Link->Y)X, GridY(Link->Y+8), DIR_LEFT, 1, false, noEdge)){ Link->Y = GridY(Link->Y+8); Link->X--; LinkMovement[indexX]++; } //If Link has been blocked, clear the push value. This will also end the loop. else{ LinkMovement[indexX] = 0; } } //Right for(int i=0; iInputRight; i++){ if(__LinkMovement_CanSwim(Link->X, Link->Y, DIR_RIGHT, 1, false, noEdge)){ Link->X++; LinkMovement[indexX]--; } //This is unused, but would snap Link to the grid if he's close enough to aligned else if(Imprecision>0&&Abs(GridY(Link->Y+8)-Link->Y)X, GridY(Link->Y+8), DIR_RIGHT, 1, false, noEdge)){ Link->Y = GridY(Link->Y+8); Link->X++; LinkMovement[indexX]--; } //If Link has been blocked, clear the push value. This will also end the loop. else{ LinkMovement[indexX] = 0; } } //Up for(int i=0; iInputUp; i++){ if(__LinkMovement_CanSwim(Link->X, Link->Y, DIR_UP, 1, false, noEdge)){ Link->Y--; LinkMovement[indexY]++; } //This is unused, but would snap Link to the grid if he's close enough to aligned else if(Imprecision>0&&Abs(GridX(Link->X+8)-Link->X)X+8), Link->Y, DIR_UP, 1, false, noEdge)){ Link->X = GridX(Link->X+8); Link->Y--; LinkMovement[indexY]++; } //If Link has been blocked, clear the push value. This will also end the loop. else{ LinkMovement[indexY] = 0; } } //Down for(int i=0; iInputDown; i++){ if(__LinkMovement_CanSwim(Link->X, Link->Y, DIR_DOWN, 1, false, noEdge)){ Link->Y++; LinkMovement[indexY]--; } //This is unused, but would snap Link to the grid if he's close enough to aligned else if(Imprecision>0&&Abs(GridX(Link->X+8)-Link->X)X+8), Link->Y, DIR_DOWN, 1, false, noEdge)){ Link->X = GridX(Link->X+8); Link->Y++; LinkMovement[indexY]--; } //If Link has been blocked, clear the push value. This will also end the loop. else{ LinkMovement[indexY] = 0; } } } ffc script Cutscenes{ void run(int scene, int numtear, int distance){ if(scene == 1){ for(int i = 0; i<172; i++){ Screen->DrawScreen(1, 11, 0x00, 0, 0-i, 0); Screen->DrawScreen(1, 11, 0x01, 0, 172-i, 0); WaitI(); } WaitI(60); if(numtear == 1){ this->Data = CMB_AUTOWARPA + 1; WaitI(); } int S1[] = "Officially, it is not known what became of the doomed land of Hyrule. The magnificent kingdom, said to be blessed with peace and prosperity beyond compare, was simply extinguished 200 years ago, buried beneath the sea for eternity."; int S2[] = "Ask the historians and they will propose any number of theories. Perhaps tectonic shifts released a glacial flood on the kingdom. Or perhaps the people had angered the gods, calling a divine retribution down upon them."; int S3[] = "Of course, everyone knows the true fate of Hyrule."; int S4[] = "The Gerudo Curse is no secret. Every one hundred years, a primordial evil is resurrected within them. A single male is born, the reincarnation of an ancient, nameless malice."; int S5[] = "Hyrule was weak. They refused to confront the Gerudo problem head-on, hoping they might find a peaceful solution to the problem. Their foolishness paved the way for the Gerudo King, on that fateful day 200 years ago, to march his armies into Hyrule."; int S6[] = "The Knights of Hyrule fought valiantly. The armies of evil were struck down, and the demon-king cornered against the gates of Hyrule Castle. But he had one last cruelty planned. If he couldn't have Hyrule for himself, no one could."; int S7[] = "And thus, the Kingdom of Hyrule was buried that day beneath countless floodwaters. The ruins of the kingdom, far below the surface, were further smothered by a poisonous curse, choking all those would seek to dive down to the ocean floor. The Gerudo's Curse had doomed the land forever."; PlayTangoStringPortraitlessI(S1, STYLE_PORTRAITLESS, 48, 48); PlayTangoStringPortraitlessI(S2, STYLE_PORTRAITLESS, 48, 48); PlayTangoStringPortraitlessI(S3, STYLE_PORTRAITLESS, 48, 48); PlayTangoStringPortraitlessI(S4, STYLE_PORTRAITLESS, 48, 48); PlayTangoStringPortraitlessI(S5, STYLE_PORTRAITLESS, 48, 48); PlayTangoStringPortraitlessI(S6, STYLE_PORTRAITLESS, 48, 48); PlayTangoStringPortraitlessI(S7, STYLE_PORTRAITLESS, 48, 48); this->Data = 5; } if(scene == 2 && G[G_CUTSCENESDISABLED] == 0 && G[G_INTROSCENE] == 0){ this->Flags[FFCF_CARRYOVER] = true; Link->X = 176; Link->Y = 128; Link->Action = LA_SWIMMING; Wait(60); int K1[] = "This looks like the place. Guess I better find Abei."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); while(Link->Y > 80){ // Link->Y--; // if(Link->Action == LA_SWIMMING && Screen->ComboT[ComboAt(Link->X, Link->Y)] != CT_WATER) // Link->Action = LA_WALKING; Link->InputUp = true; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Waitframe(); // Wait(); } Link->Item[51] = false; while(Game->GetCurScreen() != 0x77 || Distance(Link->X, Link->Y, 128, 72) > 4) Waitframe(); int A1[] = "Wait! You mustn't go into the water!"; PlayTangoString(A1, STYLE_OTHER, 84, 48, 8); Link->Dir = DIR_RIGHT; Link->Action = LA_ATTACKING; Wait(); Link->Action = LA_NONE; ffc Abei = Screen->LoadFFC(11); Abei->X = 252; Abei->Y = 32; Abei->Data = 3338; Abei->CSet = 8; while(Abei->X > 200){ Abei->X--; Wait(); } Abei->Data--; while(Abei->Y < Link->Y){ Abei->Y++; Wait(); } Abei->Data++; while(Abei->X > Link->X + 16){ Abei->X--; Wait(); } int K2[] = "Er... is something the matter?"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int A2[] = "That water is dangerous, boy! Have you not heard of the curse?"; PlayTangoString(A2, STYLE_OTHER, 84, 48, 8); int K3[] = "I suppose the letter did mention something of a curse, though it was vague."; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int A3[] = "Letter... oh! My apologies! You must be Prince Kell. It is an honor, your highness."; PlayTangoString(A3, STYLE_OTHER, 84, 48, 8); int K4[] = "The honor is mine. I assume you're Abei?"; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); int A4[] = "That I am. It is a pleasure to make your acquaintance. I apologize for not recognizing you sooner. When I wrote, I was expecting your mother."; PlayTangoString(A4, STYLE_OTHER, 84, 48, 8); int K5[] = "... Mother is dead."; PlayTangoString(K5, STYLE_KELL, 30620, 48, 8); int A5[] = "She is!? I'm terribly sorry... I had no idea."; PlayTangoString(A5, STYLE_OTHER, 84, 48, 8); int K6[] = "That's alright. Her passing was rather recent. I've come to help in her stead."; PlayTangoString(K6, STYLE_KELL, 30620, 48, 8); int A6[] = "That is very much appreciated. Come this way."; PlayTangoString(A6, STYLE_OTHER, 84, 48, 8); Abei->Data++; while(Abei->X < 200){ Abei->X++; Wait(); } Abei->Data = 3336; while(Abei->Y > 32){ Abei->Y--; Wait(); } Abei->Data = 3339; while(Abei->X < 252){ Abei->X++; Wait(); } Abei->Data = 0; while(Game->GetCurScreen() != 0x78) Waitframe(); Abei = Screen->LoadFFC(11); Abei->X = 128; Abei->Y = 32; Abei->Data = 3338; Abei->CSet = 8; while(Link->Y < 32){ Link->InputUp = false; Link->InputDown = true; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Waitframe(); } while(Link->X < 112){ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = true; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Waitframe(); } Link->Action = LA_ATTACKING; Wait(); Link->Action = LA_NONE; int A7[] = "I'm very grateful for your help, Prince Kell, but... I hope you don't mind me asking, but are you sure you're able? You're rather... youthful."; PlayTangoString(A7, STYLE_OTHER, 84, 48, 80); int K7[] = "Oh, don't worry about that. Zora age much more slowly than you Hylians do. By the time we appear adult to you, we're 30 or 40 years old."; PlayTangoString(K7, STYLE_KELL, 30620, 48, 80); int A8[] = "Yes, of course, I do recall this now. Forgive me for assuming your age."; PlayTangoString(A8, STYLE_OTHER, 84, 48, 80); int K8[] = "Of course. There's no need to worry. I'm already 13. I'm more than mature enough for this."; PlayTangoString(K8, STYLE_KELL, 30620, 48, 80); int A9[] = "Er... if you say so, your highness."; PlayTangoString(A9, STYLE_OTHER, 84, 48, 80); Abei->Data = 3336; while(Abei->Y > -16){ Abei->Y--; Wait(); } Abei->Data = 0; while(Game->GetCurScreen() != 0x68) Waitframe(); Abei = Screen->LoadFFC(11); Abei->X = Link->X; Abei->Y = 112; Abei->Data = 3337; Abei->CSet = 8; while(Link->Y > 128){ Link->InputUp = true; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Waitframe(); } int K9[] = "I was hoping you could tell me a bit more about this curse. Your letter is pretty vague on the subject."; PlayTangoString(K9, STYLE_KELL, 30620, 48, 8); int A10[] = "Ah, yes, forgive me for getting ahead of myself. It all started a few months ago. We saw black smoke billowing from the caves that lead down to the ruins. I was able to ask some passing Zora to investigate, but they only reached some 200 feet below the water when they began to choke and burn. It wasn't long after that that even the shallows around the cave began to burn and emit a noxious fume. Surely you recognize this! It's the same curse that the demon king covered the flooded land of Hyrule in!"; PlayTangoString(A10, STYLE_OTHER, 84, 48, 8); int K10[] = "It sounds similar, I'll grant that. But there could be other explanations for-"; PlayTangoString(K10, STYLE_KELL, 30620, 48, 8); int A11[] = "It's more than just smoke and burning water! At night, shadows sometimes emerge from the water, stalking the town's streets. This is no natural phenomenon. It's a curse! A curse billowing forth from the ruins of Hyrule!"; PlayTangoString(A11, STYLE_OTHER, 84, 48, 8); int K11[] = "That does sound slightly more convincing. But why would the curse around Hyrule suddenly stretch to the ocean's surface?"; PlayTangoString(K11, STYLE_KELL, 30620, 48, 8); int A12[] = "Is it not obvious? The Gerudo King is seeking his revenge! 100 years ago, we stopped the demon from unleashing unspeakable evils upon us in this very town! But his death is only a temporary setback. He's reborn every hundred years, and now he surely seeks revenge upon us! No doubt, he's drawing upon the same source of evil power that doomed Hyrule 200 years ago!"; PlayTangoString(A12, STYLE_OTHER, 84, 48, 8); int K12[] = "The time frame does fit. And I suppose we can find out easily enough. That shrine you mentioned-"; PlayTangoString(K12, STYLE_KELL, 30620, 48, 8); int A13[] = "Yes, right this way!"; PlayTangoString(A13, STYLE_OTHER, 84, 48, 8); Abei->Data = 3339; while(Abei->X < 144){ Abei->X++; Wait(); } Abei->Data = 3336; while(Abei->Y > -16){ Abei->Y--; Wait(); } Abei->Data = 0; while(Game->GetCurScreen() != 0x48) Waitframe(); Abei = Screen->LoadFFC(11); Abei->X = 96; Abei->Y = 128; Abei->Data = 3337; Abei->CSet = 8; int K13[] = "Wow... it really is as grand as you described it."; PlayTangoString(K13, STYLE_KELL, 30620, 48, 8); int A14[] = "Yes, it is truly marvelous. Long ago, when this town was a mountain peak far above Hyrule, people would come to this shrine seeking favors, or so it is said. Step onto the altar and ask for a means to dispel the curse."; PlayTangoString(A14, STYLE_OTHER, 84, 48, 8); SetLayerComboD(1, ComboAt(96, 128), 4950); while(Distance(Link->X, Link->Y, 120, 104) > 2) Waitframe(); int K14[] = "Um... I would like to dispel the curse plaguing this town."; PlayTangoString(K14, STYLE_KELL, 30620, 48, 8); int S1[] = "Understood. Please present spiritual stone."; PlayTangoStringPortraitless(S1, STYLE_PORTRAITLESS, 48, 8); int A15[] = "You brought it with you, right?"; PlayTangoString(A15, STYLE_OTHER, 84, 48, 8); int K21[] = "Yes, I have it. The Spiritual Stone of the Zora race."; PlayTangoString(K21, STYLE_KELL, 30620, 48, 8); int A16[] = "The Zora's Engagement Ring, your mother called it way back then."; PlayTangoString(A16, STYLE_OTHER, 84, 48, 8); int K15[] = "It's tradition that the crown prince or princess present it to the person they wish to marry. Mother always liked to joke that it was a glorified engagement ring."; PlayTangoString(K15, STYLE_KELL, 30620, 48, 8); ffc Sapphire = Screen->LoadFFC(12); Sapphire->X = 120; Sapphire->Y = 88; Sapphire->Data = 4931; Sapphire->CSet = 6; Wait(60); int S2[] = "Zora Sapphire recognized. Please hold for light infusion process."; PlayTangoStringPortraitless(S2, STYLE_PORTRAITLESS, 48, 8); LightInfusion(); Wait(30); int S3[] = "Error: Insufficient light stores to fully charge spiritual stone. Spiritual stone cannot dispel curse. Sufficient charge to provide protection against curse was provided."; PlayTangoStringPortraitless(S3, STYLE_PORTRAITLESS, 48, 8); int A17[] = "What does it mean?"; PlayTangoString(A17, STYLE_OTHER, 84, 48, 8); int K17[] = "It sounds like the shrine is missing something it needs to dispel the curse. But that it was able to power up the Sapphire enough to grant resistance to it."; PlayTangoString(K17, STYLE_KELL, 30620, 48, 8); int A18[] = "Of course... The legends speak of Tears of Light, which were used as a fuel source for all sorts of fantastical machines in ancient times. Those must be what the shrine is missing!"; PlayTangoString(A18, STYLE_OTHER, 84, 48, 8); int K18[] = "Do the legends say where we can find them?"; PlayTangoString(K18, STYLE_KELL, 30620, 48, 8); int A19[] = "Only that they were hidden away in other shrines throughout Hyrule. The majority of them probably lie underwater now. Even if we could get down there, the curse would-"; PlayTangoString(A19, STYLE_OTHER, 84, 48, 8); int K19[] = "I don't mean to interrupt, but reaching the ocean floor shouldn't be a problem for a Zora. And if the Sapphire truly can provide protection against the curse-"; PlayTangoString(K19, STYLE_KELL, 30620, 48, 8); int A20[] = "Of course! Prince Kell, if I could beseech you to travel to Hyrule and find these tears of light, we would be forever in your debt."; PlayTangoString(A20, STYLE_OTHER, 84, 48, 8); int K20[] = "You don't need to beg. The Hylians have aided the Zoras countless times before. It's my duty to return that favor."; PlayTangoString(K20, STYLE_KELL, 30620, 48, 8); int A21[] = "Thank you! Please, if there's anything that we can do to help, let me know!"; PlayTangoString(A21, STYLE_OTHER, 84, 48, 8); int S4[] = "Calculations complete. Three tears of light will be necessary to further charge Zora's Sapphire. Additional information: Sapphire can be charged with each tear of light to decrease rate of vitality depletion on damage. Suggestion: Return here after collecting each tear of light."; PlayTangoStringPortraitless(S4, STYLE_PORTRAITLESS, 48, 8); int K22[] = "See what you can find about the location of those shrines. I suppose I'll start searching myself."; PlayTangoString(K22, STYLE_KELL, 30620, 48, 8); Link->Item[51] = true; Sapphire->Data = 0; G[G_INTROSCENE] = 1; this->Flags[FFCF_CARRYOVER] = false; Quit(); } if(scene == 3 && G[G_POSTLEVELONESCENE] == 0 && G[G_NUMTEARS] == 1){ G[G_POSTLEVELONESCENE] = 1; ffc Riggs = FindFreeFFC(); Riggs->CSet = 6; if(Game->GetCurScreen() == 0x4E){ Riggs->Data = 5017; Riggs->X = 16; Riggs->Y = 64; } if(Game->GetCurScreen() == 0x74){ Riggs->Data = 5019; Riggs->X = 32; Riggs->Y = 112; } if(Game->GetCurScreen() == 0x3B){ Riggs->Data = 5018; Riggs->X = 184; Riggs->Y = 96; } Wait(4); for(int i = Screen->NumNPCs(); i>0; i--){ npc n = Screen->LoadNPC(i); n->Y = -10000; n->HP = -10000; } if(Game->GetCurScreen() == 0x4E) Link->Dir = DIR_UP; Wait(30); Waitframes(30); if(Game->GetCurScreen() == 0x4E){ Riggs->Data = 5022; while(Riggs->X >= -16){ Riggs->X--; Waitframe(); } Riggs->Data = 0; } if(Game->GetCurScreen() == 0x74){ Riggs->Data = 5022; while(Riggs->X >= -16){ Riggs->X--; Waitframe(); } Riggs->Data = 0; } if(Game->GetCurScreen() == 0x3B){ Riggs->Data = 5021; while(Riggs-> Y<= 172){ Riggs->Y++; Waitframe(); } Riggs->Data = 0; } } if(scene == 3 && G[G_POSTLEVELTWOSCENE] == 0 && G[G_NUMTEARS] == 2){ Game->PlayMIDI(0); Wait(4); for(int i = Screen->NumNPCs(); i>0; i--){ npc n = Screen->LoadNPC(i); n->Y = -10000; n->HP = -10000; } for(int i = 0; i<120; i++){ if(i%30 == 0) Game->PlaySound(100); Screen->Quake = 1; Wait(); } int K1[] = "That didn't feel good. I should head back to the surface and make sure everything's alright."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); UndoLynelMusic(); G[G_POSTLEVELTWOSCENE] = 1; } if(scene == 4 && G[G_TOWNATTACKONEEXTRO] == 0 && Game->GetCurScreen() == 0x77 && G[G_NUMTEARS] >= 2){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; Game->ContinueDMap = 0; Game->LastEntranceDMap = 0; Game->ContinueScreen = 0x77; Game->LastEntranceScreen = 0x77; int Music[] = "R6 - Lynel.gbs"; Game->SetDMapEnhancedMusic(9, Music, 11); Game->PlayEnhancedMusic(Music, 11); MoveLinkDown(112); if(G[G_TOWNATTACKONEINTRO] == 0){ int K1[] = "Oh no..."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); } MoveLinkRight(128); MoveLinkUp(64); MoveLinkRight(208); MoveLinkUp(32); MoveLinkRight(240); } if(scene == 4 && G[G_TOWNATTACKONEEXTRO] == 0 && Game->GetCurScreen() == 0x79 && G[G_NUMTEARS] >= 2){ while(Distance(Link->X, Link->Y, 176, 72) > 2) Waitframe(); G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; Game->ContinueDMap = 17; Game->LastEntranceDMap = 17; Game->ContinueScreen = 0x6E; Game->LastEntranceScreen = 0x6E; int Music[] = "R6 - Lynel.gbs"; Game->SetDMapEnhancedMusic(9, Music, 11); Game->PlayEnhancedMusic(Music, 11); if(G[G_TOWNATTACKONEINTRO] == 0){ int K1[] = "Oh no..."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); } MoveLinkUp(72); MoveLinkLeft(0); Link->InputLeft = true; } if(scene == 4 && G[G_TOWNATTACKONEEXTRO] == 0 && Game->GetCurScreen() == 0x78 && G[G_NUMTEARS] >= 2){ // Game->ContinueDMap = 0; // Game->LastEntranceDMap = 0; // Game->ContinueScreen = 0x77; // Game->LastEntranceScreen = 0x77; if(Link->X < 160) MoveLinkRight(160); else MoveLinkLeft(160); MoveLinkUp(0); Link->InputUp = true; } if(scene == 4 && G[G_TOWNATTACKONEEXTRO] == 0 && Game->GetCurScreen() == 0x68 && G[G_NUMTEARS] >= 2){ // Game->ContinueDMap = 0; // Game->LastEntranceDMap = 0; // Game->ContinueScreen = 0x77; // Game->LastEntranceScreen = 0x77; ffc Abei = Screen->LoadFFC(11); if(G[G_TOWNATTACKONEINTRO] == 0){ Abei->X = 144; Abei->Y = 64; Abei->Data = 3337; Abei->CSet = 8; } ffc DigDog = Screen->LoadFFC(12); DigDog->X = 144; DigDog->Y = 80; DigDog->Data = 6144; DigDog->TileWidth = 2; DigDog->TileHeight = 2; DigDog->Data = 6144; DigDog->CSet = 10; MoveLinkUp(112); Wait(10); DigDog->Data = 6145; Wait(10); if(G[G_TOWNATTACKONEINTRO] == 0){ int A1[] = "Kell, thank the gods! Help us!"; PlayTangoString(A1, STYLE_OTHER, 84, 48, 8); Abei->Data = 3336; while(Abei->Y >= -16){ Abei->Y--; Wait(); } Abei->Data = 0; } Wait(10); Game->PlaySound(31); Wait(10); CreateNPCAt(295, DigDog->X, DigDog->Y); DigDog->Data = 0; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); while(Screen->NumNPCs() > 0){ Link->X = Clamp(Link->X, 3, 237); Link->Y = Clamp(Link->Y, 3, 157); Waitframe(); } G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; int Music3[] = "Final Fantasy III (1990-04-27)(Square).nsf"; Game->SetDMapEnhancedMusic(9, Music3, 32); Game->PlayEnhancedMusic(Music3, 32); for(int i = 0; i<30; i++){ BlackScreenLayerSix(); Wait(); } Link->X = 144; Link->Y = 96; Link->Dir = DIR_UP; Abei->Data = 3337; Abei->X = 144; Abei->Y = 80; int A2[] = "Is it... is it dead?"; PlayTangoString(A2, STYLE_OTHER, 84, 48, 8); int K2[] = "I'm not sure it was ever alive to begin with. Are these the shadows you mentioned coming from the water?"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int A3[] = "Yes! Well, not exactly. They were never so violent before. This creature could have slaughtered the whole town had you not arrived when you did."; PlayTangoString(A3, STYLE_OTHER, 84, 48, 8); int K3[] = "What could have changed to cause this?"; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int A4[] = "I'm sure the Gerudo demon has taken notice of you by now. He likely means to accelerate his plans, rather than toy with us as he has been."; PlayTangoString(A4, STYLE_OTHER, 84, 48, 8); int K4[] = "Are you sure this wasn't just a fluke?"; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); int A5[] = "Of course I'm sure! This wasn't the only strange occurrence to befall us. Shortly before that beast's arrival, I saw a strange figure in the town square."; PlayTangoString(A5, STYLE_OTHER, 84, 48, 8); int K5[] = "That's rather vague."; PlayTangoString(K5, STYLE_KELL, 30620, 48, 8); int A6[] = "Well I couldn't very well see their face, what with that hood they were wearing. Whoever they were, they headed in the direction of the shrine. Then I lost sight of them."; PlayTangoString(A6, STYLE_OTHER, 84, 48, 8); int K6[] = "I think I saw this same person myself. They were underwater though."; PlayTangoString(K6, STYLE_KELL, 30620, 48, 8); int A7[] = "That confirms it then, doesn't it? It must be the demon king, or else one of his agents. No one else could survive underwater, not without that Sapphire of yours."; PlayTangoString(A7, STYLE_OTHER, 84, 48, 8); int K7[] = "Perhaps..."; PlayTangoString(K7, STYLE_KELL, 30620, 48, 8); Abei->Data = 3336; while(Abei->Y >= -16){ Abei->Y--; Wait(); } Abei->Data = 0; G[G_TOWNATTACKONEEXTRO] = 1; Quit(); } if(scene == 5 && G[G_CUTSCENESDISABLED] == 0 && G[G_NUMTEARS] == 3 && G[G_LIGHTSINFUSED] < 3){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; int A1[] = "Welcome back Kell! How goes the search?"; PlayTangoString(A1, STYLE_OTHER, 84, 48, 8); int K1[] = "I've got the three tears."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); int A2[] = "Wonderful! That's what you need, right shrine?"; PlayTangoString(A2, STYLE_OTHER, 84, 48, 8); int S1[] = "Correct. Please present spiritual stone for light infusion process."; PlayTangoStringPortraitless(S1, STYLE_PORTRAITLESS, 48, 8); while(Distance(Link->X, Link->Y, 120, 104) > 2) Waitframe(); ffc Sapphire = Screen->LoadFFC(12); Sapphire->X = 120; Sapphire->Y = 88; Sapphire->Data = 4931; Sapphire->CSet = 6; Wait(60); int S2[] = "Zora Sapphire recognized. Please hold for light infusion process."; PlayTangoStringPortraitless(S2, STYLE_PORTRAITLESS, 48, 8); LightInfusion(); Wait(30); int S3[] = "Infusion process complete. Spiritual stone is now able to dispel area of mild curse concentration. Analysis: One further tear of light is required to dispel moderate curse concentration. Suggestion: Use newly infused power to locate one additional tear of light."; PlayTangoStringPortraitless(S3, STYLE_PORTRAITLESS, 48, 8); int K2[] = "Sounds like we're going to need more than just three."; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int A3[] = "Yes, but this is progress! The ability to dispel the curse, at least in places where it is weak, should open new roads for you."; PlayTangoString(A3, STYLE_OTHER, 84, 48, 8); Sapphire->Data = 0; G[G_LIGHTSINFUSED] = 3; } if(scene == 6 && G[G_RACISMSCENE] == 0 && G[G_LIGHTSINFUSED] == 3){ ffc Gerudo = FindFreeFFC(); Gerudo->X = 120; Gerudo->Y = 144; Gerudo->Data = 3423; Gerudo->CSet = 6; ffc Guard = FindFreeFFC(); Guard->X = 136; Guard->Y = 144; Guard->Data = 3354; Guard->CSet = 7; Wait(120); int Gu1[] = "I said that's enough! Get out of my town, demon spawner!"; PlayTangoString(Gu1, STYLE_OTHER, 29502, 48, 8); Guard->X-=2; Game->PlaySound(11); Gerudo->Data = 3424; Wait(10); Guard->X+=2; Wait(20); MoveLinkDown(128); MoveLinkRight(136); Link->Dir = DIR_DOWN; int K1[] = "What do you think you're doing?"; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); Guard->Data = 3352; int Gu2[] = "I'm protecting our town!"; PlayTangoString(Gu2, STYLE_OTHER, 29502, 48, 8); int K2[] = "Protecting it? From an unarmed woman?"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int Gu3[] = "She's a Gerudo! Wherever they travel, trouble follows. Any one of them could spawn the next demon king."; PlayTangoString(Gu3, STYLE_OTHER, 29502, 48, 8); int K3[] = "And that gives you the right to abuse her like this?"; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int Gu4[] = "Are you seriously defending her? Her race is responsible for this curse in the first place! If my grandfather hadn't helped stop the Gerudo King 100 years ago, this town might not even exist anymore!"; PlayTangoString(Gu4, STYLE_OTHER, 29502, 48, 8); int K4[] = "And tell me, was this woman part of those events?"; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); int Gu5[] = "Well, no, but-"; PlayTangoString(Gu5, STYLE_OTHER, 29502, 48, 8); int K5[] = "Then you have no right to treat her like this. Go back to your post, before I reconsider helping your town out of this mess."; PlayTangoString(K5, STYLE_KELL, 30620, 48, 8); int Gu6[] = "One day, you'll grow up and see how foolish you are. I only hope that happens before your childish mindset dooms your people."; PlayTangoString(Gu6, STYLE_OTHER, 29502, 48, 8); Guard->Data = 3353; while(Guard->Y < 172){ Guard->Y++; Wait(); } Guard->Data = 0; MoveLinkLeft(120); Link->Dir = DIR_DOWN; int K6[] = "Here, let me help you up."; PlayTangoString(K6, STYLE_KELL, 30620, 48, 8); Wait(10); Gerudo->Data = 3420; int G1[] = "Thank you for driving that brute off."; PlayTangoString(G1, STYLE_OTHER, 63312, 48, 8); int K7[] = "Of course. I'm sorry you had to deal with that."; PlayTangoString(K7, STYLE_KELL, 30620, 48, 8); int G2[] = "It's nothing I'm not used to. Few people take kindly to us around these parts."; PlayTangoString(G2, STYLE_OTHER, 63312, 48, 8); int K8[] = "It's so childish of them, blaming an entire race for a single man's problems. Though I suppose the memory of the Demon King's last attack is still fairly fresh for them."; PlayTangoString(K8, STYLE_KELL, 30620, 48, 8); int G3[] = "Don't tell me one as wise as you has fallen for that propaganda."; PlayTangoString(G3, STYLE_OTHER, 63312, 48, 8); int K9[] = "Propaganda? What do you mean?"; PlayTangoString(K9, STYLE_KELL, 30620, 48, 8); int G4[] = "Their story of the resurrected Demon King attacking them here 100 years ago, and them heroically fighting him off, is a complete fiction."; PlayTangoString(G4, STYLE_OTHER, 63312, 48, 8); int K10[] = "Fiction? But the Demon King resurrects every 100 years. If they didn't-"; PlayTangoString(K10, STYLE_KELL, 30620, 48, 8); int G5[] = "No, that's not right. It is true that only one male is born to the Gerudo every 100 years. And it is true that, in the past, the Demon King has incarnated as a Gerudo. But this concept you have of the Demon King resurrecting in us every 100 years is nonsense. Every 100 years, there is a male Gerudo. Nothing more."; PlayTangoString(G5, STYLE_OTHER, 63312, 48, 8); int K11[] = "Oh... Then 100 years ago..."; PlayTangoString(K11, STYLE_KELL, 30620, 48, 8); int G6[] = "100 years ago, a Gerudo woman made the mistake of traveling through this town with her young son. Rumors spread through the town like wildfire. She tried to explain to them, but they'd given themselves over to hysteria already."; PlayTangoString(G6, STYLE_OTHER, 63312, 48, 8); int K12[] = "What happened to the boy?"; PlayTangoString(K12, STYLE_KELL, 30620, 48, 8); int G7[] = "He was seized by a mob and taken to town square. And there... there, he was burned alive at the stake."; PlayTangoString(G7, STYLE_OTHER, 63312, 48, 8); int K13[] = "That's terrible. That... that can't be right."; PlayTangoString(K13, STYLE_KELL, 30620, 48, 8); int G8[] = "Do you doubt the capacity of others for blind hatred, even after seeing what transpired here moments ago?"; PlayTangoString(G8, STYLE_OTHER, 63312, 48, 8); int K14[] = "No, not at all. But... how do I know that your story isn't the fiction? The Gerudo would have just as much reason to invent a story like that if the Hylians' story was the truth, wouldn't they?"; PlayTangoString(K14, STYLE_KELL, 30620, 48, 8); int R1[] = "You can check for yourself."; PlayTangoString(R1, STYLE_RIGGS, 30549, 48, 8); ffc Riggs = FindFreeFFC(); Riggs->X = 136; Riggs->Y = 172; Riggs->Data = 5020; Riggs->CSet = 6; while(Riggs->Y > Link->Y){ Riggs->Y--; Wait(); } Link->Dir = DIR_RIGHT; Riggs->Data = 5018; int K15[] = "You... you're the one I saw before, underwater. And the one Abei saw before that shadow creature attacked."; PlayTangoString(K15, STYLE_KELL, 30620, 48, 8); int R2[] = "..."; PlayTangoString(R2, STYLE_RIGGS, 30549, 48, 8); int K16[] = "What do you mean I can check for myself?"; PlayTangoString(K16, STYLE_KELL, 30620, 48, 8); int R3[] = "They buried the so-called Demon King on a tiny island to the west. Set up a marker to celebrate their victory. Exhume the remains, and you'll see for yourself that it's not an adult's corpse."; PlayTangoString(R3, STYLE_RIGGS, 30549, 48, 8); int K17[] = "You expect me to dig up a corpse?"; PlayTangoString(K17, STYLE_KELL, 30620, 48, 8); int R4[] = "If you want to know the truth."; PlayTangoString(R4, STYLE_RIGGS, 30549, 48, 8); Riggs->Data = 5021; while(Riggs->Y < 152){ Riggs->Y++; Wait(); } Riggs->Data = 5017; Link->Dir = DIR_DOWN; int K18[] = "Wait! Who are you? How did you survive underwater? How did you survive the curse? Did you have anything to do with that monster that attacked?"; PlayTangoString(K18, STYLE_KELL, 30620, 48, 8); Wait(30); int R5[] = "What do you think?"; PlayTangoString(R5, STYLE_RIGGS, 30549, 48, 8); Riggs->Data = 5021; while(Riggs->Y < 172){ Riggs->Y++; Wait(); } Riggs->Data = 0; int G9[] = "I'll take my leave now. If you want to know anything more of my people, I'll be happy to speak with you again."; PlayTangoString(G9, STYLE_OTHER, 63312, 48, 8); Gerudo->Data = 3425; while(Gerudo->Y < 172){ Gerudo->Y++; Wait(); } Gerudo->Data = 0; G[G_RACISMSCENE] = 1; } if(scene == 7 && G[G_RACISMSCENE] == 1 && G[G_GRAVESCENE] == 0 && G[G_MIDPOINTSCENE] == 0){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; while(Distance(Link->X, Link->Y, this->X, this->Y) > 8) Waitframe(); int K1[] = "I can't believe I'm about to do this. But I need to know if what the Gerudo say is true."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); for(int i = 0; i<90; i++){ BlackScreenLayerSix(); Wait(); } int K2[] = "This skeleton is smaller than I am. With the rate the Gerudo age, he couldn't have been older than 10 when he died."; PlayTangoStringBlackScreen(K2, STYLE_KELL, 30620, 48, 8); for(int i = 0; i<90; i++){ BlackScreenLayerSix(); Wait(); } int K3[] = "So it's true. They... they murdered an innocent child. It almost makes me upset they're all long gone by now. They're the ones who deserve to deal with this curse."; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); G[G_GRAVESCENE] = 1; } if(scene == 8 && G[G_LEVELFOURENTRANCESCENE] == 0){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; ffc Riggs = FindFreeFFC(); Riggs->Data = 5017; Riggs->CSet = 6; Riggs->X = 48; Riggs->Y = 80; Waitframes(30); Riggs->Data = 5022; while(Riggs-> X>= -16){ Riggs->X--; Waitframe(); } Riggs->Data = 0; G[G_LEVELFOURENTRANCESCENE] = 1; } if(scene == 9 && G[G_LEVELFOURTEARSCENE] == 0){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; while(Distance(Link->X, Link->Y, 144, 128) > 8) Waitframe(); while(Distance(Link->X, Link->Y, 168, 128) > 8) Waitframe(); Link->Action = LA_ATTACKING; Wait(); Link->Action = LA_NONE; int R1[] = "Are you really turning back after making it this far because of a block?"; PlayTangoString(R1, STYLE_RIGGS, 30549, 48, 8); Link->Dir = DIR_RIGHT; ffc Riggs = FindFreeFFC(); Riggs->X = 240; Riggs->Y = 80; Riggs->Data = 5022; Riggs->CSet = 6; while(Riggs->X > 208){ Riggs->X--; Wait(); } Riggs->Data = 5018; int K1[] = "Why are you following me?"; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); int R2[] = "Following you? I was here first. Why are you following me?"; PlayTangoString(R2, STYLE_RIGGS, 30549, 48, 8); int K2[] = "And why can't you ever just give a straight answer?"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int R3[] = "The last time I tried that, I ended up with a sword pointed at me."; PlayTangoString(R3, STYLE_RIGGS, 30549, 48, 8); int K3[] = "What was the question?"; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int R4[] = "'Who are you?'"; PlayTangoString(R4, STYLE_RIGGS, 30549, 48, 8); int K4[] = "You're not doing a great job of making me trust you."; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); int R5[] = "I never said I was trying to."; PlayTangoString(R5, STYLE_RIGGS, 30549, 48, 8); int K5[] = "But you are, aren't you?"; PlayTangoString(K5, STYLE_KELL, 30620, 48, 8); int R6[] = "..."; PlayTangoString(R6, STYLE_RIGGS, 30549, 48, 8); Riggs->Data = 5021; while(Riggs->Y < 112){ Riggs->Y++; Wait(); } Riggs->Data = 5022; while(Riggs->X > 192){ Riggs->X--; Wait(); } Riggs->Data = 5021; while(Riggs->Y < 128){ Riggs->Y++; Wait(); } Riggs->Data = 5022; while(Riggs->X > 144){ Riggs->X--; Wait(); } Link->Dir = DIR_LEFT; Wait(20); Screen->ComboD[ComboAt(128, 128)] = 516; Screen->ComboC[ComboAt(128, 128)] = 2; ffc Block = FindFreeFFC(); Block->Data = 628; Block->CSet = 3; Block->X = 128; Block->Y = 128; Game->PlaySound(50); while(Block->X > 96){ Block->X--; Riggs->X--; Wait(); } Riggs->Data = 5019; Screen->ComboD[ComboAt(Riggs->X, Riggs->Y)] = 5003; int K6[] = "Why are you helping me? Who are you?"; PlayTangoString(K6, STYLE_KELL, 30620, 48, 8); int R7[] = "Someone who wants to see you collect those tears."; PlayTangoString(R7, STYLE_RIGGS, 30549, 48, 8); int K7[] = "But why?"; PlayTangoString(K7, STYLE_KELL, 30620, 48, 8); int R8[] = "You and I have the same goal, even if you don't realize it yet."; PlayTangoString(R8, STYLE_RIGGS, 30549, 48, 8); int K8[] = "Then why keep up the mysterious act?"; PlayTangoString(K8, STYLE_KELL, 30620, 48, 8); int R9[] = "You'll see soon enough."; PlayTangoString(R9, STYLE_RIGGS, 30549, 48, 8); Screen->State[ST_SECRET] = true; G[G_LEVELFOURTEARSCENE] = 1; } if(scene == 10 && G[G_MIDPOINTSCENE] == 0 && G[G_NUMTEARS] == 4){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; int K1[] = "I have the fourth tear."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); int S1[] = "Tear of Light count confirmed. Please present spiritual stone for light infusion process."; PlayTangoStringPortraitless(S1, STYLE_PORTRAITLESS, 48, 8); while(Distance(Link->X, Link->Y, 120, 104) > 2) Waitframe(); ffc Opal = Screen->LoadFFC(11); //Grab this first so it'll appear on top of the Sapphire. Also for some reason Riggs was grabbing this FFC so manually defining them Opal->Data = 4951; Opal->X = 300; ffc Sapphire = Screen->LoadFFC(13); Sapphire->X = 120; Sapphire->Y = 88; Sapphire->Data = 4931; Sapphire->CSet = 6; Wait(60); int S2[] = "Zora Sapphire recognized. Please hold for light infusion process."; PlayTangoStringPortraitless(S2, STYLE_PORTRAITLESS, 48, 8); ffc Riggs = Screen->LoadFFC(12); Riggs->Data = 5020; Riggs->CSet = 6; Riggs->X = 176; Riggs->Y = 168; while(Riggs->Y > 88){ Riggs->Y--; Wait(); } Riggs->Data = 5018; int ThrowHeight = GetThrowHeight(Riggs->X, Riggs->Y, 120, 88, 2); int Z; Opal->Data = 4951; Opal->X = Riggs->X; Opal->Y = Riggs->Y; Game->PlaySound(45); while(Opal->X > Sapphire->X){ ThrowHeight = Max(ThrowHeight-GH_GRAVITY, -GH_TERMINAL_VELOCITY); Z+= ThrowHeight; Opal->X-=2; // Opal->Y = 88 - Max(ThrowHeight, 0); Opal->Y = 88 - Max(Z, 0); Screen->FastTile(1, Opal->X, 88, 27401, 7, OP_OPAQUE); Wait(); } Opal->Y = 88; Wait(30); int S3[] = "Gerudo Opal recognized. Please hold for light infusion process."; PlayTangoStringPortraitless(S3, STYLE_PORTRAITLESS, 48, 8); LightInfusion(); int S4[] = "Infusion process complete. Spiritual stones are now able to dispel area of moderate curse concentration. Analysis: Three further tears of light are required to dispel heavy curse concentration."; PlayTangoStringPortraitless(S4, STYLE_PORTRAITLESS, 48, 8); Link->Dir = DIR_RIGHT; int K2[] = "You... you had a spiritual stone?"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int R1[] = "What, you didn't think the Zoras were the only race with one of those, did you? The Gerudo's Opal has been passed down by Gerudo chieftains for centuries."; PlayTangoString(R1, STYLE_RIGGS, 30549, 48, 8); int K3[] = "Who are you?"; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int R2[] = "Why are you asking questions you already know the answer to?"; PlayTangoString(R2, STYLE_RIGGS, 30549, 48, 8); Riggs->Data = 5040; Wait(10); Riggs->Data = 5041; Wait(10); Riggs->Data = 5034; int R3[] = "Surprise! Or not. You gonna point your weapon at me too? Everyone else does when I answer that question."; PlayTangoString(R3, STYLE_RIGGS, 30464, 48, 8); int K4[] = "I'm strongly considering it."; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); MoveLinkDown(128); Riggs->Data = 5036; while(Riggs->Y > 48){ Riggs->Y-=2; Wait(); } Link->Dir = DIR_UP; Riggs->Data = 5038; while(Riggs->X > 120){ Riggs->X-=2; Wait(); } Riggs->Data = 5033; int R4[] = "I'm guessing you've got a lot of questions. And I'm happy to answer them. But I'm keeping this altar between us for the time being."; PlayTangoString(R4, STYLE_RIGGS, 30464, 48, 8); int K5[] = "Alright. Are you the demon king?"; PlayTangoString(K5, STYLE_KELL, 30620, 48, 8); int R5[] = "What do you think?"; PlayTangoString(R5, STYLE_RIGGS, 30464, 48, 8); int K6[] = "I think you've been acting incredibly suspiciously."; PlayTangoString(K6, STYLE_KELL, 30620, 48, 8); int R6[] = "But not inconspicuously. If I had an evil plan, don't you think I'd be better at hiding it?"; PlayTangoString(R6, STYLE_RIGGS, 30464, 48, 8); int K7[] = "Then why all the sneaking around and hiding your face?"; PlayTangoString(K7, STYLE_KELL, 30620, 48, 8); int R7[] = "You can answer that one. You went to the grave, didn't you?"; PlayTangoString(R7, STYLE_RIGGS, 30464, 48, 8); if(G[G_GRAVESCENE] == 0){ int K8[] = "... No. I couldn't bring myself to."; PlayTangoString(K8, STYLE_KELL, 30620, 48, 8); int R8[] = "You couldn't bring yourself to cuz you already knew what you'd find, right?"; PlayTangoString(R8, STYLE_RIGGS, 30464, 48, 8); int K8a[] = "Something like that."; PlayTangoString(K8a, STYLE_KELL, 30620, 48, 8); } else{ int K8b[] = "Yes... I saw the skeleton there."; PlayTangoString(K8b, STYLE_KELL, 30620, 48, 8); } int R9[] = "Then you know exactly why I've been careful to stay hidden."; PlayTangoString(R9, STYLE_RIGGS, 30464, 48, 8); int K9[] = "That explains why you'd hide from the townspeople, but why hide from me?"; PlayTangoString(K9, STYLE_KELL, 30620, 48, 8); int R10[] = "I've been trying to carefully show you I'm on your side and you still don't trust me. Would you have believed me if just came up and explained myself?"; PlayTangoString(R10, STYLE_RIGGS, 30464, 48, 8); int K10[] = "... I suppose not. I saw you underwater though. Your spiritual stone could keep you safe from the curse, but how do you breathe down there?"; PlayTangoString(K10, STYLE_KELL, 30620, 48, 8); int R11[] = "Ages ago, the Zora royal family made some armor for the Hylians that allowed them to breathe underwater. I can't speak much to their fashion sense, but your folks make durable armor. The pieces I found still work."; PlayTangoString(R11, STYLE_RIGGS, 30464, 48, 8); int K17[] = "How did you push that block out of the way? It seemed far too heavy to move."; PlayTangoString(K17, STYLE_KELL, 30620, 48, 8); int R20[] = "Oh that. Gerudo Power Gauntlets. Another family heirloom."; PlayTangoString(R20, STYLE_RIGGS, 30464, 48, 8); int K11[] = "And why did you help me get that last tear?"; PlayTangoString(K11, STYLE_KELL, 30620, 48, 8); int R12[] = "I already told you, we share a goal. I wanna get rid of this curse as much as you do."; PlayTangoString(R12, STYLE_RIGGS, 30464, 48, 8); Wait(60); int R13[] = "Any more questions? Or are we good now?"; PlayTangoString(R13, STYLE_RIGGS, 30464, 48, 8); int K12[] = "I suppose we're good now."; PlayTangoString(K12, STYLE_KELL, 30620, 48, 8); int R14[] = "Perfect."; PlayTangoString(R14, STYLE_RIGGS, 30464, 48, 8); Riggs->Data = 5039; while(Riggs->X < 176){ Riggs->X++; Wait(); } Link->Dir = DIR_RIGHT; Riggs->Data = 5037; while(Riggs->Y < Link->Y){ Riggs->Y++; Wait(); } Riggs->Data = 5038; while(Riggs->X > Link->X + 16){ Riggs->X--; Wait(); } Riggs->Data = 5034; int R15[] = "The name's Riggs, prince of the Gerudo."; PlayTangoString(R15, STYLE_RIGGS, 30464, 48, 8); int K13[] = "You don't act much like a prince."; PlayTangoString(K13, STYLE_KELL, 30620, 48, 8); int R16[] = "Who says a prince is supposed to act a certain way?"; PlayTangoString(R16, STYLE_RIGGS, 30464, 48, 8); int K14[] = "Society."; PlayTangoString(K14, STYLE_KELL, 30620, 48, 8); int R17[] = "Yeah, well society also says I oughta be burned at the stake, so I don't really give a damn about what they say. Anyway, ready to track down those next three tears?"; PlayTangoString(R17, STYLE_RIGGS, 30464, 48, 8); int K15[] = "You're coming with me?"; PlayTangoString(K15, STYLE_KELL, 30620, 48, 8); int R18[] = "Why not? Don't you ever get lonely down there, digging through ancient ruins all by yourself?"; PlayTangoString(R18, STYLE_RIGGS, 30464, 48, 8); int K16[] = "Are you capable enough?"; PlayTangoString(K16, STYLE_KELL, 30620, 48, 8); int S5[] = "Analysis: The Gerudo male is faster, though with less natural defenses than you. Cursory review of weaponry suggests the chains he uses to attack are less effective at damaging enemies than your trident, though likely are more versatile at attacking from an angle."; PlayTangoStringPortraitless(S5, STYLE_PORTRAITLESS, 48, 8); int R19[] = "Hey, no one asked you, shrine. But yeah, I'm capable enough. And I can read the Gerudo writing on those tablets you might've found lying around. So let's go."; PlayTangoString(R19, STYLE_RIGGS, 30464, 48, 8); while(Riggs->X > Link->X){ Riggs->X--; Wait(); } Riggs->Data = 0; MoveLinkUp(104); Sapphire->Data = 0; Opal->Data = 0; G[G_MIDPOINTSCENE] = 1; G[G_LIGHTSINFUSED] = 4; G[G_RIGGSJOINED] = 1; Link->Item[56] = true; PassiveTiles[0] = 23027; } if(scene == 11 && (G[G_LIGHTSINFUSED] >= numtear || (G[G_RANDO] == 1 && G[G_REQUIREDRANDO] == 1 && G[G_LIGHTSINFUSED]>=1)) && Screen->State[ST_SECRET] == false){ while(Distance(Link->X, Link->Y, this->X, this->Y) > distance) Waitframe(); G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; ffc Gem = FindFreeFFC(); if(Link->Item[RING_RIGGS]) Gem->Data = 4951; else Gem->Data = 4931; Gem->CSet = 6; Gem->X = Link->X; Gem->Y = Link->Y; Gem->Flags[FFCF_OVERLAY] = true; while(Gem->X != this->X || Gem->Y != this->Y){ if(G[G_GLOBALFRAMES] % 2 == 0){ if(Gem->X > this->X) Gem->X--; if(Gem->X < this->X) Gem->X++; if(Gem->Y > this->Y) Gem->Y--; if(Gem->Y < this->Y) Gem->Y++; } Wait(); } Game->PlaySound(64); Wait(20); Game->PlaySound(64); Wait(20); Game->PlaySound(64); Game->PlaySound(66); Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; for(int i = 0; i<250; i+=4){ Screen->Circle(6,this->X+8,this->Y+8,i,0x5B,1,0,0,0,false,OP_OPAQUE); if(i>4) Screen->Circle(6,this->X+8,this->Y+8,i-4,0x58,1,0,0,0,false,OP_OPAQUE); Wait(); } Wait(30); while(Gem->X != Link->X || Gem->Y != Link->Y){ if(G[G_GLOBALFRAMES] % 2 == 0){ if(Gem->X > Link->X) Gem->X--; if(Gem->X < Link->X) Gem->X++; if(Gem->Y > Link->Y) Gem->Y--; if(Gem->Y < Link->Y) Gem->Y++; } Wait(); } Gem->Data = 0; } if(scene == 12 && !(G[G_MIDPOINTSCENE] == 0 && G[G_NUMTEARS] == 4) && !(G[G_NUMTEARS] == 3 && G[G_LIGHTSINFUSED] < 3 && G[G_RANDO] == 0) && G[G_LIGHTSINFUSED] < G[G_NUMTEARS]){ while(Distance(Link->X, Link->Y, 120, 104) > 2) Waitframe(); G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; ffc Sapphire = Screen->LoadFFC(12); ffc Opal = Screen->LoadFFC(13); if(G[G_RIGGSJOINED] == 0){ Sapphire->X = 120; Sapphire->Y = 88; Sapphire->Data = 4931; Sapphire->CSet = 6; Wait(60); int S2[] = "Zora Sapphire recognized. Please hold for light infusion process."; PlayTangoStringPortraitless(S2, STYLE_PORTRAITLESS, 48, 8); LightInfusion(); Wait(30); int S3[] = "Infusion process complete. Spiritual stone now further slows rate of deterioration of health upon taking damage."; PlayTangoStringPortraitless(S3, STYLE_PORTRAITLESS, 48, 8); } else{ Sapphire->X = 112; Sapphire->Y = 88; Sapphire->Data = 4931; Sapphire->CSet = 6; Opal->X = 128; Opal->Y = 88; Opal->Data = 4951; Opal->CSet = 6; Wait(60); if(G[G_RANDO] == 0){ int S2[] = "Zora Sapphire and Gerudo Opal recognized. Please hold for light infusion process."; PlayTangoStringPortraitless(S2, STYLE_PORTRAITLESS, 48, 8); } LightInfusion(); Wait(30); if(G[G_RANDO] == 0){ if(G[G_NUMTEARS] == 7){ int S4[] = "Infusion process complete. Spiritual stones can now dispel areas of heavy curse concentration. One further tear of light is required to dispel the source of the curse."; PlayTangoStringPortraitless(S4, STYLE_PORTRAITLESS, 48, 8); } else if(G[G_NUMTEARS] == 8){ int S4[] = "Infusion process complete. Spiritual stones can now dispel curse."; PlayTangoStringPortraitless(S4, STYLE_PORTRAITLESS, 48, 8); int R1[] = "This is it. Ready?"; PlayTangoString(R1, STYLE_RIGGS, 30464, 48, 8); int K1[] = "As I'll ever be. Let's finish this."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); } else{ int S3[] = "Infusion process complete. Spiritual stones now further slow rate of deterioration of health upon taking damage."; PlayTangoStringPortraitless(S3, STYLE_PORTRAITLESS, 48, 8); } } } Sapphire->Data = 0; Opal->Data = 0; G[G_LIGHTSINFUSED] = G[G_NUMTEARS]; G[G_MAXLIGHTTIMER] = G[G_LIGHTSINFUSED] * 1575; G[G_LIGHTTIMER] = G[G_MAXLIGHTTIMER]; } if(scene == 13 && G[G_RIGGSJOINED] == 1 && G[G_SWIMSCENE] == 0){ if(Game->GetCurScreen() == 0x79){ while(Distance(Link->X, Link->Y, 176, 104) > 2) Waitframe(); } if(Game->GetCurScreen() == 0x6D){ while(Link->Y < 112) Waitframe(); } G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; if(Game->GetCurScreen() == 0x6D){ int RX[] = "It's salt water. This cave must lead out to the ocean."; PlayTangoString(RX, STYLE_RIGGS, 30464, 48, 8); } bool RiggsGib; ffc Riggs = FindFreeFFC(); if(Link->Item[RING_RIGGS]){ Link->Item[RING_RIGGS] = false; Riggs->Flags[FFCF_OVERLAY] = true; RiggsGib = true; } Riggs->Data = 5033; Riggs->CSet = 6; Riggs->X = Link->X; Riggs->Y = Link->Y; MoveLinkDown(128); Riggs->Flags[FFCF_OVERLAY] = true; Link->Dir = DIR_UP; Link->Action = LA_SWIMMING; int K1[] = "Hop on my head. We'll be able to travel much faster that way."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); int R1[] = "Are you always in the habit of asking people you've just met to ride you? Awful unbecoming behaviour for a prince, don't you think?"; PlayTangoString(R1, STYLE_RIGGS, 30464, 48, 8); int K2[] = "That is not at all what I meant! I'll have you know that-"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int R2[] = "I know, I know. Just keeping you on your toes."; PlayTangoString(R2, STYLE_RIGGS, 30464, 48, 8); Riggs->Data = 5037; int yoff = 9; while(Riggs->Y < Link->Y - yoff){ Link->PressA = false; Link->InputA = false; Riggs->Y++; Wait(); } Riggs->Data = 5033; Riggs->X -= 1; for(int i = 0; i<10; i++){ Wait(); Link->PressA = false; Link->InputA = false; } Link->Dir = DIR_RIGHT; Link->Action = LA_SWIMMING; Riggs->Data = 5035; Link->PressA = false; Link->InputA = false; int R3[] = "Alright, I'm ready to be whisked across the sea, my handsome gentlefish."; PlayTangoString(R3, STYLE_RIGGS, 30464, 48, 8); int K3[] = "I'll dump you in the middle of the ocean if you keep that up."; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int R4[] = "My my, didn't you learn better manners than that? I'm sure the royal court offers lessons on ferrying that state-."; PlayTangoString(R4, STYLE_RIGGS, 30464, 48, 8); Riggs->Data = 5042; Riggs->Y += yoff; for(int i = 0; i<60; i++) WaitI(); Riggs->Data = 5043; for(int i = 0; i<30; i++) WaitI(); Riggs->Data = 5035; Riggs->Y-= yoff; for(int i = 0; i<30; i++){ Wait(); Link->PressA = false; Link->InputA = false; } int R5[] = "Pfeh! I got sea water all in my mouth! If I die of salt water poisoning, that's on you! You're carrying that guilt to your grave!"; PlayTangoString(R5, STYLE_RIGGS, 30464, 48, 8); int K4[] = "I'll manage somehow."; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); Riggs->Data = 0; if(RiggsGib) Link->Item[RING_RIGGS] = true; G[G_SWIMSCENE] = 1; for(int i = 0; i<10; i++){ Link->PressA = false; Link->InputA = false; Wait(); } } if(scene == 14){ // if(Game->GetCurMap() == 14){ // for(int i = 1; i<32; i++){ // ffc f = Screen->LoadFFC(i); // if(f->Script == 19){ // f->Misc[0] = 1; // } // } // Screen->TriggerSecrets(); // Screen->State[ST_SECRET] = true; // } G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; for(int i = 0; i<60; i++){ BlackScreenLayerSix(); Wait(); } ffc Riggs = FindFreeFFC(); Riggs->X = 112; Riggs->Y = 80; Riggs->Data = 5035; Riggs->CSet = 6; ffc Kell = FindFreeFFC(); Kell->X = 128; Kell->Y = 80; Kell->Data = 5026; Kell->CSet = 6; int R1[] = "Phew. That sure was fun. A little close for comfort, I guess, but fun."; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); int K1[] = "Come. The Tear is just ahead."; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); if(Game->GetCurMap() == 7){ Kell->Data = 5029; while(Kell->Y < 128){ Kell->Y++; WaitI(); } Kell->Data = 5025; Riggs->Data = 5033; } else{ Kell->Data = 5031; while(Kell->X < 208){ Kell->X++; WaitI(); } Kell->Data = 5027; } int R2[] = "Hey Kell, what do you wanna do when you're done with all this?"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); if(Game->GetCurMap() == 7) Kell->Data = 5024; else Kell->Data = 5026; WaitI(60); int K2[] = "Why do you ask?"; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int R3[] = "Just answer the question."; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int K3[] = "Well, I should return home and-"; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int R4[] = "That's not what I asked. What do ((you)) want to do?"; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); int K4[] = "What does that matter for?"; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int R5[] = "Just seems like you only ever do what you think you're supposed to do. "; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); int K5[] = "And that's a bad thing? I'm doing my duty."; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); if(Game->GetCurMap() == 7) Kell->Data = 5025; else Kell->Data = 5027; WaitI(60); int R6[] = "You're not really happy, are you?"; PlayTangoStringI(R6, STYLE_RIGGS, 30464, 48, 8); WaitI(90); int K6[] = "I suppose not."; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int R7[] = "All you ever do is worry about the expectations people are putting on you. Am I right?"; PlayTangoStringI(R7, STYLE_RIGGS, 30464, 48, 8); int K7[] = "In a sense... How did you-"; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); int R8[] = "People expect a lot of things from me too, ya know. Some good, some not so good."; PlayTangoStringI(R8, STYLE_RIGGS, 30464, 48, 8); int K8[] = "And what do you do about that?"; PlayTangoStringI(K8, STYLE_KELL, 30620, 48, 8); int R9[] = "I learned to ignore it. I don't care what people want me to be."; PlayTangoStringI(R9, STYLE_RIGGS, 30464, 48, 8); if(Game->GetCurMap() == 7){ int ThrowHeight = GetThrowHeight(Riggs->X, Riggs->Y, 112, 128, 2); int Z; Game->PlaySound(45); int ActualY = Riggs->Y; Riggs->Data = 5044; while(ActualY < Kell->Y){ ThrowHeight = Max(ThrowHeight-GH_GRAVITY, -GH_TERMINAL_VELOCITY); Z+= ThrowHeight; ActualY+=2; Riggs->Y = ActualY - Max(Z, 0); Screen->FastTile(1, Riggs->X, ActualY, 27401, 7, OP_OPAQUE); WaitI(); } Riggs->Data = 5035; Kell->Data = 5026; } else{ int ThrowHeight = GetThrowHeight(Riggs->X, Riggs->Y, 192, 80, 2); int Z; Game->PlaySound(45); Riggs->Data = 5045; while(Riggs->X < Kell->X - 16){ ThrowHeight = Max(ThrowHeight-GH_GRAVITY, -GH_TERMINAL_VELOCITY); Z+= ThrowHeight; Riggs->X+=2; Riggs->Y = 80 - Max(Z, 0); Screen->FastTile(1, Riggs->X, 80, 27401, 7, OP_OPAQUE); WaitI(); } Riggs->Data = 5035; Kell->Data = 5026; } int R10[] = "And that's how I decided to become the loveable, brave, and enigmatic hero you see now."; PlayTangoStringI(R10, STYLE_RIGGS, 30464, 48, 8); int K9[] = "Pft, is that how you see yourself?"; PlayTangoStringI(K9, STYLE_KELL, 30620, 48, 8); int R11[] = "Come on, no need to hide it. You're free to tell me how inspiring I am and how much you want to be like me."; PlayTangoStringI(R11, STYLE_RIGGS, 30464, 48, 8); int K10[] = "I think I want to slap you if you keep that up."; PlayTangoStringI(K10, STYLE_KELL, 30620, 48, 8); int R12[] = "Hey, look at that! You just told me something ((you)) want to do! See, not so hard, is it?"; PlayTangoStringI(R12, STYLE_RIGGS, 30464, 48, 8); if(Game->GetCurMap() == 7) Kell->Data = 5025; else Kell->Data = 5027; WaitI(30); int R13[] = "Don't think I can't see you smile just because you turned around."; PlayTangoStringI(R13, STYLE_RIGGS, 30464, 48, 8); int K11[] = "I have no idea what you're talking about. Come, the Tear's waiting for us."; PlayTangoStringI(K11, STYLE_KELL, 30620, 48, 8); if(Link->Item[RING_RIGGS]){ Link->X = Riggs->X; Link->Y = Riggs->Y; Kell->Data = 5030; while(Kell->X > Riggs->X){ Kell->X--; WaitI(); } } else{ Link->X = Kell->X; Link->Y = Kell->Y; Riggs->Data = 5039; while(Riggs->X < Kell->X){ Riggs->X++; WaitI(); } } if(Game->GetCurMap() == 7){ if(Link->Item[RING_RIGGS]) Link->Dir = DIR_RIGHT; else Link->Dir = DIR_DOWN; } else Link->Dir = DIR_RIGHT; Kell->Data = 0; Riggs->Data = 0; G[G_POSTBOSSFIVESCENE] = 1; } if(scene == 15 && G[G_POSTLEVELFIVESCENE] == 0 && G[G_NUMTEARS] == 5){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; Game->PlayMIDI(0); for(int i = 0; i<120; i++){ if(i%30 == 0) Game->PlaySound(100); Screen->Quake = 1; Wait(); } int R1[] = "An earthquake?"; PlayTangoString(R1, STYLE_RIGGS, 30464, 48, 8); int K1[] = "Oh no... the last time that happe-"; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); for(int i = 0; i<120; i++){ if(i%30 == 0) Game->PlaySound(100); Screen->Quake = 1; Wait(); } int K2[] = "The last time that happened, that monster attacked the town. We need to get back there right away!"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); Screen->SetSideWarp(0, 0x78, 9, WT_IWARPBLACKOUT); this->Data = 5; } if(scene == 16 && G[G_POSTLEVELFIVESCENE] == 0 && G[G_NUMTEARS] == 5){ int Music3[] = "Final Fantasy III (1990-04-27)(Square).nsf"; Game->PlayEnhancedMusic(Music3, 14); ffc Aliya = FindFreeFFC(); Aliya->X = 112; Aliya->Y = 48; Aliya->Data = 5049; Aliya->CSet = 6; ffc Abei = FindFreeFFC(); Abei->X = 128; Abei->Y = 8; Abei->Data = 3337; Abei->CSet = 8; ffc Shopguy = FindFreeFFC(); Shopguy->X = 192; Shopguy->Y = 48; Shopguy->Data = 3358; Shopguy->CSet = 8; ffc Guard = FindFreeFFC(); Guard->X = 144; Guard->Y = 96; Guard->Data = 3352; Guard->CSet = 7; ffc Ama = FindFreeFFC(); Ama->X = 32; Ama->Y = 96; Ama->Data = 3347; Ama->CSet = 8; ffc Gerudo = FindFreeFFC(); Gerudo->X = 88; Gerudo->Y = 96; Gerudo->Data = 3420; Gerudo->CSet = 6; ffc Kell = FindFreeFFC(); Kell->X = -16; Kell->Y = 32; Kell->Data = 5031; Kell->CSet = 6; ffc Riggs = FindFreeFFC(); Riggs->X = -32; Riggs->Y = 32; Riggs->Data = 5039; Riggs->CSet = 6; while(Kell->X < 32){ Kell->X++; Riggs->X++; WaitI(); } Kell->Data = 5029; while(Riggs->X < 32){ Kell->Y++; Riggs->X++; WaitI(); } Riggs->Data = 5037; while(Riggs->Y < 48){ Kell->Y++; Riggs->Y++; WaitI(); } Kell->Data = 5027; Riggs->Data = 5035; WaitI(30); int Ab1[] = "You can't be serious about this!"; PlayTangoStringI(Ab1, STYLE_OTHER, 84, 48, 8); int A1[] = "I assure you, old man, I am deathly serious. In three days time, this town will no longer exist. The curse I've laid will rise from the waters and smother all life here, before spreading across the sea. The Hylian race and all those allied with it shall be wiped from existence."; PlayTangoStringI(A1, STYLE_ALIYA, 30684, 48, 8); int Am1[] = "But why? What did we ever do to deserve this?"; PlayTangoStringI(Am1, STYLE_OTHER, 85, 48, 8); int A2[] = "What did you do? You have a lot of nerve asking that. Two hundred years ago, you took everything from me."; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); int S1[] = "200 years ago? But that was when Hyrule was flooded."; PlayTangoStringI(S1, STYLE_OTHER, 29522, 48, 8); int A3[] = "Yes. The day Hyrule flooded. The day the Hylians murdered my father."; PlayTangoStringI(A3, STYLE_ALIYA, 30684, 48, 8); int Gu1[] = "You... you're the daughter of the Demon King!"; PlayTangoStringI(Gu1, STYLE_OTHER, 29502, 48, 8); int A4[] = "The demon king, you call him. And yet your people are the ones committing atrocities."; PlayTangoStringI(A4, STYLE_ALIYA, 30684, 48, 8); Riggs->Data = 5039; while(Riggs->X < 48){ Riggs->X++; WaitI(); } Riggs->Data = 5035; int R1[] = "What do you think you're accomplishing by doing this?"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); Aliya->Data = 5050; WaitI(30); int A5[] = "I am creating a world for us! A world where our kind need not live in fear of persecution!"; PlayTangoStringI(A5, STYLE_ALIYA, 30684, 48, 8); int R2[] = "By becoming exactly what they accuse us of being?"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int Ge1[] = "The boy is right. The Hylians may be cruel, but responding to persecution with genocide is not the Gerudo way."; PlayTangoStringI(Ge1, STYLE_OTHER, 63312, 48, 8); int A6[] = "You're both fools. One day, you'll understand and come to appreciate the world I'm giving you."; PlayTangoStringI(A6, STYLE_ALIYA, 30684, 48, 8); for(int i = 0; i<16; i++){ Guard->Y--; WaitI(); } int Gu2[] = "What makes you think we're just going to sit here and wait for death to come?"; PlayTangoStringI(Gu2, STYLE_OTHER, 29502, 48, 8); Aliya->Data = 5049; WaitI(30); int A7[] = "By all means, you're free to do what you will. But things have already been set in motion. Were I to fall here, it would be yet another body on the scales of your race's judgment."; PlayTangoStringI(A7, STYLE_ALIYA, 30684, 48, 8); Kell->Data = 5031; while(Kell->X < 48){ Kell->X++; WaitI(); } Kell->Data = 5027; int K1[] = "Everyone, stop! There's no need to resort to any of this!"; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); Aliya->Data = 5050; int A8[] = "Ah yes. You're the Zora boy who's been running about the ruins of Hyrule recently. What reason do you have to be involved in this? Has your kind not done enough already?"; PlayTangoStringI(A8, STYLE_ALIYA, 30684, 48, 8); int K2[] = "I'm not going to sit by idly and watch a genocide unfold just because it doesn't directly affect me."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int A9[] = "And yet, I don't seem to remember the Zora getting involved earlier, when our race was being exterminated."; PlayTangoStringI(A9, STYLE_ALIYA, 30684, 48, 8); int K3[] = "I wouldn't know. I wasn't alive back then."; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int A10[] = "Then it would serve you well to stay out of affairs you have no business being involved in. You're hardly better than any of them."; PlayTangoStringI(A10, STYLE_ALIYA, 30684, 48, 8); int R3[] = "He's with me, and I'm involved in this. That's good enough for me."; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int A11[] = "I would beg you to reconsider your actions. You owe these people no sympathy."; PlayTangoStringI(A11, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5052; while(Aliya->Y > 0){ Aliya->Y--; WaitI(); } Aliya->Data = 5048; int R4[] = "Wait. You're Aliya, aren't you?"; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); WaitI(15); Aliya->Data = 5049; WaitI(15); int A12[] = "How did you know?"; PlayTangoStringI(A12, STYLE_ALIYA, 30684, 48, 8); int R5[] = "My mom used to tell me stories about you. Princess Aliya was the kindest Gerudo Princess that ever lived, she said. Compassionate and gentle, an emissary of goodwill to all the other races. What happened to you?"; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); int A13[] = "I was a child once, yes. I saw the best in people. That ended when I found myself sliding down one of their blades as I watched them decapitate my father."; PlayTangoStringI(A13, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5052; while(Aliya->Y > -16){ Aliya->Y--; WaitI(); } Aliya->Data = 0; Game->PlayEnhancedMusic(Music3, 32); WaitI(120); int S2[] = "What do we do now?"; PlayTangoStringI(S2, STYLE_OTHER, 29522, 48, 8); int Gu3[] = "I told you, didn't I? Where the Gerudo go, trouble follows."; PlayTangoStringI(Gu3, STYLE_OTHER, 29502, 48, 8); int Ge2[] = "That's exactly the attitude that got us to where we are in the first place."; PlayTangoStringI(Ge2, STYLE_OTHER, 63312, 48, 8); int Gu4[] = "No, your people's curse is what got us here! How do we know these two aren't in league with that madwoman?"; PlayTangoStringI(Gu4, STYLE_OTHER, 29502, 48, 8); int Am2[] = "In league? They tried to talk her down!"; PlayTangoStringI(Am2, STYLE_OTHER, 85, 48, 8); int Gu5[] = "So they could fool us! For all we know, that boy could be the reincarnation of the Demon King. I say we-"; PlayTangoStringI(Gu5, STYLE_OTHER, 29502, 48, 8); int K4[] = "Don't even finish that sentence if you know what's good for you."; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); while(Abei->Y < 48){ Abei->Y++; WaitI(); } int Ab2[] = "Everyone, please! These are clearly trying times, but let's not tear each other apart."; PlayTangoStringI(Ab2, STYLE_OTHER, 84, 48, 8); int Gu6[] = "..."; PlayTangoStringI(Gu6, STYLE_OTHER, 29502, 48, 8); int K5[] = "He's right. I apologize for the outburst."; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int R6[] = "I appreciate it, for what it's worth."; PlayTangoStringI(R6, STYLE_RIGGS, 30464, 48, 8); int Gu7[] = "What would you have us do? Sit and wait for the end to come?"; PlayTangoStringI(Gu7, STYLE_OTHER, 29502, 48, 8); int K6[] = "To start, I want answers. The Hylians and Gerudo have totally different stories for what happened ((100)) years ago. Now it seems like we need to know what happened ((200)) years ago if we want to understand Aliya."; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int Gu8[] = "Ha, everyone knows that. The ancient Malice reincarnated as a Gerudo and became the Demon King. He formed an army and marched on Hyrule to seize the Triforce for himself. His army reached the castle gates, but was stopped there by the Knights of Hyrule. They killed him and his wicked daughter, but with his last breath, he cursed them all and called in the floodwaters to drown Hyrule."; PlayTangoStringI(Gu8, STYLE_OTHER, 29502, 48, 8); int K7[] = "And what do the Gerudo say about the events?"; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); int Ge3[] = "King Rayl was a powerful Gerudo warrior. He brought prosperity to our tribe by forming strategic alliances with the other races. The Hylians grew jealous of his power, and things came to a head outside Hyrule Castle, where they killed him and his daughter in battle. The flood began soon after."; PlayTangoStringI(Ge3, STYLE_OTHER, 63312, 48, 8); int Gu9[] = "Even a demon can bring prosperity to his tribe."; PlayTangoStringI(Gu9, STYLE_OTHER, 29502, 48, 8); int K8[] = "That's not the point. Both sides are in agreement on a few facts. The 'Demon King', Rayl, was in Hyrule. The Hylians killed him and his daughter. In the events that followed, Hyrule was drowned."; PlayTangoStringI(K8, STYLE_KELL, 30620, 48, 8); int R7[] = "But she was just here. How can she be alive to threaten us if she died 200 years ago?"; PlayTangoStringI(R7, STYLE_RIGGS, 30464, 48, 8); int Gu10[] = "Because she's the spawn of a demon. Isn't that much obvious at this point?"; PlayTangoStringI(Gu10, STYLE_OTHER, 29502, 48, 8); int Ab3[] = "Unfortunately, I don't suspect we'll get anywhere sitting here and debating what kind of man Rayl was. The fact is that his daughter is here, somehow, and something needs to be done."; PlayTangoStringI(Ab3, STYLE_OTHER, 84, 48, 8); int K9[] = "Our objective hasn't changed. If Riggs and I find the remaining tears, we'll be able to dispel the curse. We'll find out whatever we can about Aliya in the meantime."; PlayTangoStringI(K9, STYLE_KELL, 30620, 48, 8); int Ab4[] = "A reasonable enough course of action. Proceed, then."; PlayTangoStringI(Ab4, STYLE_OTHER, 84, 48, 8); // Game->PlayEnhancedMusic(Music3, 32); Abei->Data = 0; Ama->Data = 0; Shopguy->Data = 0; Guard->Data = 0; Gerudo->Data = 0; Riggs->Data = 0; Kell->Data = 0; if(Link->Item[RING_RIGGS]){ Link->X = Riggs->X; Link->Y = Riggs->Y; } else{ Link->X = Kell->X; Link->Y = Kell->Y; } Link->Dir = DIR_RIGHT; for(int i = 0; i<60; i++){ BlackScreenLayerSix(); WaitI(); } G[G_POSTLEVELFIVESCENE] = 1; } if(scene == 17){ // if(Game->GetCurMap() == 14){ // for(int i = 1; i<32; i++){ // ffc f = Screen->LoadFFC(i); // if(f->Script == 19) // f->Misc[0] = 1; // } // Screen->TriggerSecrets(); // Screen->State[ST_SECRET] = true; // } G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; for(int i = 0; i<60; i++){ BlackScreenLayerSix(); Wait(); } ffc Riggs = FindFreeFFC(); Riggs->X = 112; Riggs->Y = 80; Riggs->Data = 5035; Riggs->CSet = 6; ffc Kell = FindFreeFFC(); Kell->X = 128; Kell->Y = 80; Kell->Data = 5026; Kell->CSet = 6; int K1[] = "These monsters keep getting tougher. But this will be six tears now. We must be getting close."; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); if(Game->GetCurMap() == 7){ Kell->Data = 5029; while(Kell->Y < 128){ Kell->Y++; WaitI(); } Kell->Data = 5025; Riggs->Data = 5033; } else{ Kell->Data = 5031; while(Kell->X < 208){ Kell->X++; WaitI(); } Kell->Data = 5027; } int R1[] = "Hey Kell... can we talk for a sec?"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); if(Game->GetCurMap() == 7) Kell->Data = 5024; else Kell->Data = 5026; int K2[] = "Of course. What is it?"; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int R2[] = "I've just been thinking a lot. About Aliya. And about what she said."; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int K3[] = "Should I be worried? You're not-"; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int R3[] = "No, nothing like that! She's completely insane! But still, it's not all her fault, is it? She's a victim here too."; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int K4[] = "I suppose she is. I don't pretend to know what exactly happened, but to see your father cut down in front of you can't be pleasant."; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int R4[] = "And that's not to say it justifies what she's doing. This is just as bad as what the Hylians did to the guy who came before me. But still... I guess I get where she's coming from."; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); WaitI(90); int K5[] = "Is there something else on your mind?"; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int R5[] = "Huh? Oh, nothing, I guess. Just thinking about stuff. Let's grab that Tear and get outta here."; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); if(Game->GetCurMap() == 7){ Riggs->Data = 5037; while(Riggs->Y < Kell->Y){ Riggs->Y++; WaitI(); } Riggs->Data = 5039; while(Riggs->X < Kell->X){ Riggs->X++; WaitI(); } } else{ Riggs->Data = 5039; while(Riggs->X < Kell->X){ Riggs->X++; WaitI(); } } if(Link->Item[RING_RIGGS]) Link->Dir = DIR_RIGHT; else{ if(Game->GetCurMap() == 7) Link->Dir = DIR_UP; else Link->Dir = DIR_LEFT; } Link->X = Kell->X; Link->Y = Kell->Y; Kell->Data = 0; Riggs->Data = 0; G[G_POSTBOSSSIXSCENE] = 1; } if(scene == 18 && G[G_POSTLEVELSEVENSCENE] == 0 && G[G_NUMTEARS] == 7){ int downspot = Link->Y + 16; MoveLinkDown(downspot); if(Game->GetCurMap() == 28){ int leftspot = Link->X-8; MoveLinkLeft(leftspot); } ffc Kell = FindFreeFFC(); Kell->Data = 5025; Kell->CSet = 6; Kell->X = Link->X; Kell->Y = Link->Y; ffc Riggs = FindFreeFFC(); Riggs->Data = 5033; Riggs->CSet = 6; Riggs->X = Link->X; Riggs->Y = Link->Y; if(Link->Item[RING_RIGGS]){ Kell->Data = 5031; while(Kell->X < Riggs->X + 16){ Kell->X++; WaitI(); } Kell->Data = 5026; Riggs->Data = 5035; } else{ Riggs->Data = 5039; while(Riggs->X < Kell->X + 16){ Riggs->X++; WaitI(); } Riggs->Data = 5034; Kell->Data = 5027; } int R1[] = "And that's seven. The shrine said we'd need seven to dispel the curse, didn't it?"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); int K1[] = "It said we would need seven for areas of heavy curse concentration. I suspect it needs one more to ultimately dispel the source."; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); int A1[] = "That is correct."; PlayTangoStringI(A1, STYLE_ALIYA, 30684, 48, 8); Kell->Data = 5026; Riggs->Data = 5034; if(Game->GetCurScreen() == 0x22){ Kell->Data = 5025; Riggs->Data = 5033; } int Music3[] = "Final Fantasy III (1990-04-27)(Square).nsf"; Game->PlayEnhancedMusic(Music3, 14); ffc Aliya = FindFreeFFC(); Aliya->Data = 5055; Aliya->CSet = 6; if(Game->GetCurScreen() == 0x22){ Aliya->X = 128; Aliya->Y = 172; Aliya->Data = 5052; while(Aliya->Y > 128){ Aliya->Y--; WaitI(); } Aliya->Data = 5048; } else{ Aliya->X = -16; Aliya->Y = 96; int Xdest; if(Game->GetCurMap() == 4) Xdest = 32; else Xdest = 16; while(Aliya->X < Xdest){ Aliya->X++; WaitI(); Aliya->Data = 5051; } } int R2[] = "What are you doing here!?"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int A2[] = "I came to speak with you, and to again try to dissuade you from this path."; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); int K2[] = "Like we said earlier, we're not leaving."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int R3[] = "Yeah, we're not gonna be intimidated by you!"; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int A3[] = "Your determination is admirable. Truly, I respect you. That's why I'm begging you. If you continue down this road, I will have no choice but to stop you."; PlayTangoStringI(A3, STYLE_ALIYA, 30684, 48, 8); int K3[] = "Why is this giving you grief when massacring the Hylians doesn't?"; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int A4[] = "I hardly delight in doing this. But I have dedicated my life to ensuring the safety of the Gerudo by eliminating those who would persecute them. If the Hylians must perish to achieve that goal, so be it. But to strike down a Gerudo, especially a prince such as yourself, Riggs... it goes against everything I fight for."; PlayTangoStringI(A4, STYLE_ALIYA, 30684, 48, 8); int R4[] = "You don't have to do this, you know. Any of this."; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); int A5[] = "If only it were so. I thought, perhaps, that could be the case. When the floodwaters drowned Hyrule, I watched eagerly, hoping something new might grow from the ruins, that the prejudice and hatred might have died beneath the waves as well. And for a brief, happy period, it seemed as if that peace I longed for was achieved."; PlayTangoStringI(A5, STYLE_ALIYA, 30684, 48, 8); int K4[] = "I suppose that ended 100 years ago."; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int A6[] = "Indeed. I never had the opportunity to meet the boy, though as I watched from afar, I grew to think of him as a brother. I was hopeful that, in him, the seeds of a new era of Gerudo prosperity might sprout. But that dream died along with him. Lit ablaze in the town square, his screams melding with the chorus of cheering. That was when I accepted the truth. There would never be peace, not so long as a single Hylian drew breath."; PlayTangoStringI(A6, STYLE_ALIYA, 30684, 48, 8); int R5[] = "I can't imagine what it must have been like, but-"; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); int A7[] = "That is precisely the problem! You are blind to the cruelty of this world! You seek an end to my curse, hoping that might somehow justify your existence in the eyes of the Hylians. But it won't. It never will. They'll turn on you, sooner or later. And I can't bear to watch another prince burn away. Riggs, I am begging you. For your own sake, turn away from this! Let me help you!"; PlayTangoStringI(A7, STYLE_ALIYA, 30684, 48, 8); int R6[] = "I can't do that. I don't care how noble your intentions are. This isn't going to change anything."; PlayTangoStringI(R6, STYLE_RIGGS, 30464, 48, 8); int K5[] = "He's right, Aliya. All you're doing here is confirming people's worst fears of the Gerudo and perpetuating the cycle of bloodshed that brought us here."; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int A8[] = "How can neither of you see? I'm not perpetuating the cycle. I'm ending it, once and for all."; PlayTangoStringI(A8, STYLE_ALIYA, 30684, 48, 8); int R7[] = "Aliya, please, if you'd just-"; PlayTangoStringI(R7, STYLE_RIGGS, 30464, 48, 8); int A9[] = "Everything I do, I do for the good of the Gerudo. And if you would choose to protect those who persecute us... then I shall do what I must, no matter how much it pains me."; PlayTangoStringI(A9, STYLE_ALIYA, 30684, 48, 8); if(Game->GetCurScreen() == 0x22){ Aliya->Data = 5053; while(Aliya->Y < 172){ Aliya->Y++; WaitI(); } Aliya->Data = 0; } else{ Aliya->Data = 5054; while(Aliya->X > -16){ Aliya->X--; WaitI(); } Aliya->Data = 0; } if(Link->Item[RING_RIGGS]){ Kell->Data = 5030; while(Kell->X > Riggs->X){ Kell->X--; WaitI(); } } else{ Riggs->Data = 5038; while(Riggs->X > Kell->X){ Riggs->X--; WaitI(); } } Riggs->Data = 0; Kell->Data = 0; UndoLynelMusic(); G[G_POSTLEVELSEVENSCENE] = 1; } if(scene == 19){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; int SpeedLineX[20]; int SpeedLineY[20]; int angle[3] = {90, 4, 0}; for(int i=0; i<20; i++){ SpeedLineX[i] = Rand(256); SpeedLineY[i] = Rand(176); } Link->X = 120; Link->Y = 160; int spincounter = 8; while(Link->Y > 90){ Link->Y--; if(G[G_GLOBALFRAMES] % 2 == 0) Link->Y--; SpeedLines(SpeedLineX, SpeedLineY); if(G[G_GLOBALFRAMES] % 8 == 0){ if(Link->Dir == DIR_UP) Link->Dir = DIR_RIGHT; else if(Link->Dir == DIR_RIGHT) Link->Dir = DIR_DOWN; else if(Link->Dir == DIR_DOWN) Link->Dir = DIR_LEFT; else Link->Dir = DIR_UP; } Wait(); } ffc Kell = FindFreeFFC(); Kell->Data = 5024; Kell->CSet = 6; ffc Riggs = FindFreeFFC(); Riggs->Data = 5033; Riggs->CSet = 6; Kell->X = Link->X; Kell->Y = Link->Y; Riggs->X = Link->X; Riggs->Y = Link->Y; Kell->Flags[FFCF_OVERLAY] = true; for(int i = 0; i<45; i++){ SpeedLines(SpeedLineX, SpeedLineY); Circling(Kell, Riggs, angle); WaitI(); } if(Game->GetCurDMap() == 29){ int R1[] = "Whoa! Look how high up we're going!"; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K1[] = "Surely this isn't the same tower as the one near the cliffs above water?"; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "I think it is! And we're going all the way to the top! This is awesome!"; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "It suppose it is somewhat inter-"; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "Oh come on Kell, drop the royal accent and proper word choice around me already."; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "... I guess it's pretty amazing."; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R4[] = "That's more like it! Let's go!"; PlayTangoStringTower(R4, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } if(Game->GetCurDMap() == 30){ int R1[] = "Man, it's crazy how far we've come. It feels like we only just started yesterday."; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K1[] = "Not to be rude, but I was doing this for a while before you joined."; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "Hey, that's not true! I was doing stuff too!"; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "Like stalking me from the shadows?"; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "Well when you put it like that, it almost makes me sound creepy."; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "You were."; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R4[] = "But creepy in a good way, right? Mysterious, tortured, but with a heart of gold?"; PlayTangoStringTower(R4, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K4[] = "Mostly just creepy, really."; PlayTangoStringTower(K4, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } if(Game->GetCurDMap() == 31){ int K1[] = "Once we have the last Tear, and we can finally dispel the curse, we're going to have to address Aliya."; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R1[] = "Yeah... she's probably not gonna let us waltz in and undo it."; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "She will likely put up a fight."; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "Definitely."; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "And once we win, if we just leave her, she'll be free to start the curse all over again."; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "I know... it kinda limits our options."; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } if(Game->GetCurDMap() == 32){ int R1[] = "I've been thinking, maybe we could get through to Aliya."; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K1[] = "She doesn't seem very open to listening to us."; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "I know, I know! But maybe we're just going about this wrong."; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "How many ways are there to go about calling out a genocide?"; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "Not many, I guess. But maybe if we just talk to her more, we could get her to see how unreasonable she's being."; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "I highly doubt that."; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } if(Game->GetCurDMap() == 33){ int R1[] = "So when we talk to Aliya-"; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K1[] = "Riggs, I want to be able to convince her as much as you do. But I think she's too far gone."; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "I know it's a longshot. I get it. But I just want one chance. One more try to get through to her. That's all I'm asking for here."; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "And if she doesn't listen?"; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "If she doesn't listen... then we have to stop her. Whatever that takes. I'm ready for that."; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "If this is too much, I could always-"; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R4[] = "No. I need to be a part of this. I want to put the Gerudo's past behind us for good. And if that means killing it, then I'm ready."; PlayTangoStringTower(R4, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } if(Game->GetCurDMap() == 34){ int R1[] = "Hey Kell. When this is all over, what do you want to do?"; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K1[] = "You already asked me that."; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "Yeah, but you didn't give me a straight answer."; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "Well... I really should return home. Even if just briefly."; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "But?"; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "But I'd like to spend some more time away. To see more of the world, and to take an active part in solving its problems. Aliya said the Zora didn't get involved before, when the Hylians were persecuting the Gerudo. I want to change that."; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R4[] = "I bet you could. People would listen to you. You're charismatic. Well, sort of, at least. Kinda stuffy and stoic at times, and when you're addressing groups you start to sound like some old guy from a history book, and-"; PlayTangoStringTower(R4, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K4[] = "Was this supposed to be a compliment? It's starting to sound more like an insult."; PlayTangoStringTower(K4, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } if(Game->GetCurDMap() == 35){ int K1[] = "What about you, Riggs?"; PlayTangoStringTower(K1, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R1[] = "Huh?"; PlayTangoStringTower(R1, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K2[] = "When this is all over, what are you going to do?"; PlayTangoStringTower(K2, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R2[] = "Oh... Well, I'd like to stop the persecution of the Gerudo, obviously. Maybe I could talk some sense into the Hylians? I dunno. A permanent home for us, somewhere we could be safe, might be nice."; PlayTangoStringTower(R2, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K3[] = "I think that's a noble goal. Perhaps once we stop the curse, people will finally see you're not a threat. You could go across the sea and help out where you can. You could give the people a new face to attach to the Gerudo in their mind."; PlayTangoStringTower(K3, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R3[] = "Yeah... I could, I guess."; PlayTangoStringTower(R3, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int K4[] = "You don't sound very excited about it."; PlayTangoStringTower(K4, STYLE_KELL, 30620, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); int R4[] = "No, I am. It's what I want. It's just... I wish I had an excuse to spend more time with you in the end."; PlayTangoStringTower(R4, STYLE_RIGGS, 30464, 48, 8, Kell, Riggs, SpeedLineX, SpeedLineY, angle); } angle[2] = 4; while(angle[2]>0){ SpeedLines(SpeedLineX, SpeedLineY); Circling(Kell, Riggs, angle); WaitI(); } Kell->Data = 0; Riggs->Data = 0; while(Link->Y > 0){ Link->Y--; if(G[G_GLOBALFRAMES] % 2 == 0) Link->Y--; SpeedLines(SpeedLineX, SpeedLineY); if(G[G_GLOBALFRAMES] % 8 == 0){ if(Link->Dir == DIR_UP) Link->Dir = DIR_RIGHT; else if(Link->Dir == DIR_RIGHT) Link->Dir = DIR_DOWN; else if(Link->Dir == DIR_DOWN) Link->Dir = DIR_LEFT; else Link->Dir = DIR_UP; } Wait(); } G[G_TOWERSCENESTART + Game->GetCurDMap() - 29] = 1; this->Data = CMB_AUTOWARPA; } if(scene == 20){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; for(int i = 0; i<30; i++){ BlackScreenLayerSix(); Wait(); } if(G[G_RANDO] == 1) Quit(); ffc Kell = FindFreeFFC(); Kell->Data = 5025; Kell->CSet = 6; Kell->X = 112; Kell->Y = 96; ffc Riggs = FindFreeFFC(); Riggs->Data = 5033; Riggs->CSet = 6; Riggs->X = 128; Riggs->Y = 96; ffc Aliya = FindFreeFFC(); Aliya->Data = 5048; Aliya->CSet = 6; Aliya->X = 120; Aliya->Y = 128; WaitI(60); int A1[] = "So this is how my life finally ends. I hadn't imagined it would be such a beautiful location."; PlayTangoStringI(A1, STYLE_ALIYA, 30684, 48, 8); int R1[] = "Aliya-"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); int A2[] = "Don't. Just let me die with dignity, Riggs."; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); Kell->Data = 5029; for(int i = 0; i<16; i++){ Kell->Y++; WaitI(); } Kell->Data = 5025; WaitI(120); int A3[] = "What are you waiting for, Zora?"; PlayTangoStringI(A3, STYLE_ALIYA, 30684, 48, 8); WaitI(120); int A4[] = "Do it!"; PlayTangoStringI(A4, STYLE_ALIYA, 30684, 48, 8); int K1[] = "I've been thinking about what you said, Aliya. You were right. The Zora have taken the easy road. They've turned their eyes from your people's suffering, and allowed Gerudo to die if it was the more convenient option."; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); WaitI(60); int K2[] = "That ends today."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int A5[] = "You're... not killing me?"; PlayTangoStringI(A5, STYLE_ALIYA, 30684, 48, 8); int R2[] = "You're not?"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int K3[] = "Enough Gerudo blood has been spilled already. I'll not add to that misery."; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int A6[] = "... Perhaps I misjudged you, Zora."; PlayTangoStringI(A6, STYLE_ALIYA, 30684, 48, 8); int K4[] = "I think you've misjudged a great deal of people. An entire race of them."; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int A7[] = "On that point, I must disagree. But I will concede that... perhaps I have made a mistake in my judgment."; PlayTangoStringI(A7, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5054; while(Aliya->X > 88){ Aliya->X--; WaitI(); } Aliya->Data = 5052; while(Aliya->Y > 96){ Aliya->Y--; WaitI(); } Aliya->Data = 5051; Kell->Data = 5026; Riggs->Data = 5034; WaitI(30); int A8[] = "The source of the curse lies within Hyrule Castle, at the bottom of the Great Chasm. I will meet you there."; PlayTangoStringI(A8, STYLE_ALIYA, 30684, 48, 8); int R3[] = "You're... helping us?"; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int A9[] = "I said no such thing. It is still my ardent belief that the Gerudo would be safer with the Hylians exterminated."; PlayTangoStringI(A9, STYLE_ALIYA, 30684, 48, 8); int R4[] = "... but?"; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); int A10[] = "But, perhaps there is another option available to me."; PlayTangoStringI(A10, STYLE_ALIYA, 30684, 48, 8); int K5[] = "That's quite vague."; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int A11[] = "I offer no promises. But for one who is willing to atone for the mistakes of his ancestors... I offer a chance."; PlayTangoStringI(A11, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5052; while(Aliya->Y > 32){ Aliya->Y--; WaitI(); } Aliya->Data = 5055; while(Aliya->X < 120){ Aliya->X++; WaitI(); } Aliya->Data = 5052; while(Aliya->Y > -16){ Aliya->Y--; WaitI(); } Aliya->Data = 0; WaitI(60); Riggs->Data = 5037; while(Riggs->Y < Kell->Y){ Riggs->Y++; WaitI(); } Riggs->Data = 5034; Kell->Data = 5027; int R5[] = "What do you think she meant?"; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); int K6[] = "I don't know."; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int R6[] = "You don't think we convinced her to change her mind, do you?"; PlayTangoStringI(R6, STYLE_RIGGS, 30464, 48, 8); int K7[] = "No. There must be something else, something she's not telling us."; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); int R7[] = "Only one way to know for sure! Let's get the tear, get down to Hyrule Castle, dispel the curse, and see what she's on about!"; PlayTangoStringI(R7, STYLE_RIGGS, 30464, 48, 8); Riggs->Data = 5038; Kell->Data = 5031; for(int i = 0; i<8; i++){ Kell->X++; Riggs->X--; WaitI(); } Link->X = Riggs->X; Link->Y = Riggs->Y; Link->Dir = DIR_UP; Riggs->Data = 0; Kell->Data = 0; int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); } } void LightInfusion(){ int Color = 0x95; for(int i = 0; i<120; i++){ Screen->Line(6, 48+8, 48+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->Line(6, 192+8, 48+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->Line(6, 48+8, 144+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->Line(6, 192+8, 144+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); if(G[G_GLOBALFRAMES]%20 == 0) Game->PlaySound(91); Wait(); } int tile = 12772; for(int i = 0; i<180; i++){ Screen->Line(6, 48+8, 48+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->Line(6, 192+8, 48+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->Line(6, 48+8, 144+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->Line(6, 192+8, 144+8, 120+8, 88+8, Color, -1, 0, 0, 0, OP_OPAQUE); Screen->DrawTile(6, 96, 72, tile, 4, 3, 9, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(G[G_GLOBALFRAMES]%10 == 0){ if(tile == 12772) tile = 12776; else tile = 12772; } if(G[G_GLOBALFRAMES]%20 == 0) Game->PlaySound(92); Wait(); } } void SpeedLines(int SpeedLineX, int SpeedLineY){ for(int i=0; i<20; i++){ SpeedLineY[i]+=10; if(SpeedLineY[i]>172){ SpeedLineX[i] = Rand(256); SpeedLineY[i] = -32; } Screen->Line(0, SpeedLineX[i], SpeedLineY[i], SpeedLineX[i], SpeedLineY[i]+32, C_FALLING_SPEEDLINE, 1, 0, 0, 0, 128); } } void Circling(ffc Kell, ffc Riggs, int angle){ int xeccentricity = 20; int yeccentricity = 8; int ycenter = 80; angle[0]+=4; if(angle[0] >=360) angle[0]-=360; if(angle[1] > 0){ if(G[G_GLOBALFRAMES] % 4 == 0) angle[1] --; if(angle[1] == 4){ xeccentricity = 4; yeccentricity = 0; } else if(angle[1] == 3){ xeccentricity = 8; yeccentricity = 2; } else if(angle[1] == 2){ xeccentricity = 12; yeccentricity = 4; } else if(angle[1] == 1){ xeccentricity = 16; yeccentricity = 6; } else if(angle[1] == 0){ xeccentricity = 20; yeccentricity = 8; } } if(Link->Y > 80 && angle[2] == 0){ Link->Y--; if(G[G_GLOBALFRAMES] % 2 == 0 && ycenter > 80) Link->Y--; ycenter = Link->Y; } if(angle[2] > 0){ if(G[G_GLOBALFRAMES] % 4 == 0) angle[2] --; if(angle[2] == 4){ xeccentricity = 16; yeccentricity = 6; } else if(angle[2] == 3){ xeccentricity = 12; yeccentricity = 4; } else if(angle[2] == 2){ xeccentricity = 8; yeccentricity = 2; } else if(angle[2] == 1){ xeccentricity = 4; yeccentricity = 0; } else if(angle[2] == 0){ xeccentricity = 0; yeccentricity = 0; } } if(angle[2] > 0){ Link->Y--; if(G[G_GLOBALFRAMES] % 2 == 0 && ycenter > 80) Link->Y--; ycenter = Link->Y; } Kell->X = 120 + xeccentricity * Cos(angle[0]); Kell->Y = ycenter + yeccentricity * Sin(angle[0]); Riggs->X = 120 + xeccentricity * Cos(angle[0]+180); Riggs->Y = ycenter + yeccentricity * Sin(angle[0]+180); if(angle[0] >=45 && angle[0] <135){ Kell->Data = 5024; Riggs->Data = 5033; if(!Kell->Flags[FFCF_OVERLAY]) Kell->Flags[FFCF_OVERLAY] = true; if(Riggs->Flags[FFCF_OVERLAY]) Riggs->Flags[FFCF_OVERLAY] = false; } else if(angle[0] >= 135 && angle[0] < 225){ Kell->Data = 5027; Riggs->Data = 5034; } else if(angle[0] >= 225 && angle[0] < 315){ Kell->Data = 5025; Riggs->Data = 5032; if(!Riggs->Flags[FFCF_OVERLAY]) Riggs->Flags[FFCF_OVERLAY] = true; if(Kell->Flags[FFCF_OVERLAY]) Kell->Flags[FFCF_OVERLAY] = false; } else{ Kell->Data = 5026; Riggs->Data = 5035; } } void PlayTangoStringTower(int string, int style, int tile, int x, int y, ffc Kell, ffc Riggs, int SpeedLineX, int SpeedLineY, int angle){ Tango_ClearSlot(0); Tango_LoadString(0, string); Tango_SetSlotStyle(0, style); Tango_SetSlotPosition(0, x, y); Tango_ActivateSlot(0); int timer; while(Tango_SlotIsActive(0)){ KillDirInput(); if(Link->InputA && !Tango_SlotIsFinished(0)) Link->PressA; if(Tango_SlotIsFinished(0)) timer++; if((Link->PressA || Link->PressB) && timer > 50){ Tango_ClearSlot(0); break; } if((Link->InputA || Link->InputB) && timer > 60){ Tango_ClearSlot(0); break; } TangoPortraiDraws(tile); SpeedLines(SpeedLineX, SpeedLineY); Circling(Kell, Riggs, angle); WaitI(); } G[G_NOITEMS] = 2; Link->InputA = false; Link->PressA = false; SpeedLines(SpeedLineX, SpeedLineY); Circling(Kell, Riggs, angle); WaitI(); } } ffc script Cutscenes2{ //Because the first one got big enough that ZC ran out of memory void run(int scene){ if(scene == 21 && G[G_PREZELDASCENE] == 0){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; // ffc Kell = FindFreeFFC(); // Kell->Data = 5025; // Kell->CSet = 6; // Kell->X = 112; // Kell->Y = 96; // ffc Riggs = FindFreeFFC(); // Riggs->Data = 5033; // Riggs->CSet = 6; // Riggs->X = 128; // Riggs->Y = 96; ffc Aliya = FindFreeFFC(); Aliya->Data = 5049; Aliya->CSet = 6; Aliya->X = 120; Aliya->Y = 44; MoveLinkUp(112); Wait(60); int A1[] = "You made it."; PlayTangoString(A1, STYLE_ALIYA, 30684, 48, 8); int R1[] = "Are you surprised?"; PlayTangoString(R1, STYLE_RIGGS, 30464, 48, 8); int A2[] = "No. Just... conflicted."; PlayTangoString(A2, STYLE_ALIYA, 30684, 48, 8); int K1[] = "You said the source of the curse was here."; PlayTangoString(K1, STYLE_KELL, 30620, 48, 8); int A3[] = "Yes. In the very next room. Before you enter though, we need to talk."; PlayTangoString(A3, STYLE_ALIYA, 30684, 48, 8); int K2[] = "Before, you said you were adamant this curse was the only way forward. What changed?"; PlayTangoString(K2, STYLE_KELL, 30620, 48, 8); int A4[] = "To understand that, you need to know the whole story."; PlayTangoString(A4, STYLE_ALIYA, 30684, 48, 8); int R2[] = "Well don't just act all broody and mysterious then. Tell us! What happened 200 years ago? Why were you and your dad attacking Hyrule Castle? How are you even still alive?"; PlayTangoString(R2, STYLE_RIGGS, 30464, 48, 8); int A5[] = "We were ((not)) attacking Hyrule Castle. We were defending it."; PlayTangoString(A5, STYLE_ALIYA, 30684, 48, 8); int K3[] = "Defending it? From whom?"; PlayTangoString(K3, STYLE_KELL, 30620, 48, 8); int A6[] = "The Hylians."; PlayTangoString(A6, STYLE_ALIYA, 30684, 48, 8); int R3[] = "That doesn't make any sense. Why would the Hylians attack their own castle?"; PlayTangoString(R3, STYLE_RIGGS, 30464, 48, 8); int A7[] = "To kill my father. An act they succeeded in."; PlayTangoString(A7, STYLE_ALIYA, 30684, 48, 8); int K4[] = "Stop avoiding the core problem, Aliya. What was your father doing inside Hyrule Castle?"; PlayTangoString(K4, STYLE_KELL, 30620, 48, 8); int A8[] = "It was our home. Mine, my father, King Rayl's, and my mother, Queen Zelda's."; PlayTangoString(A8, STYLE_ALIYA, 30684, 48, 8); int K5[] = "I'm sorry, what?"; PlayTangoString(K5, STYLE_KELL, 30620, 48, 8); int R4[] = "Your mom is ((Queen Zelda))?"; PlayTangoString(R4, STYLE_RIGGS, 30464, 48, 8); int A9[] = "Yes. It's a bit of history the Hylians were all too eager to bury. Rayl and Zelda both wished for the same thing. Peace. An end to the fighting, to the persecution. So, a political marriage was arranged."; PlayTangoString(A9, STYLE_ALIYA, 30684, 48, 8); int K6[] = "Not a relation born out of love, then?"; PlayTangoString(K6, STYLE_KELL, 30620, 48, 8); int A21[] = "No, but a partnership born from a common goal. I respected them both for that. Though, in hindsight, it taught me a valuable lesson."; PlayTangoString(A21, STYLE_ALIYA, 30684, 48, 8); int R5[] = "Did that lesson happen to be try to get along with your enemy?"; PlayTangoString(R5, STYLE_RIGGS, 30464, 48, 8); int A10[] = "The other races will never love the Gerudo. If my own parents, who were desperate to unite our people, couldn't manage, then what hope is there?"; PlayTangoString(A10, STYLE_ALIYA, 30684, 48, 8); int R6[] = "I think you took away the wrong lesson from that marriage..."; PlayTangoString(R6, STYLE_RIGGS, 30464, 48, 8); int K7[] = "So if you're Zelda's daughter, that makes you half Hylian, does it not? You're willing to exterminate your own people?"; PlayTangoString(K7, STYLE_KELL, 30620, 48, 8); int A11[] = "They were more than happy to cut me down. They are ((not)) my people."; PlayTangoString(A11, STYLE_ALIYA, 30684, 48, 8); int K20[] = "And that justifies what you're doing now?"; PlayTangoString(K20, STYLE_KELL, 30620, 48, 8); int A22[] = "I never said that. I don't act out of revenge. I act out of a desire to save the Gerudo. The Hylians are but a necessary sacrifice."; PlayTangoString(A22, STYLE_ALIYA, 30684, 48, 8); int R7[] = "Let me interrupt for a minute. You keep talking about how the Hylians tried to kill you. How did you survive? You told us yourself that they impaled you on a sword."; PlayTangoString(R7, STYLE_RIGGS, 30464, 48, 8); int A12[] = "That was possible through a gift of the royal family."; PlayTangoString(A12, STYLE_ALIYA, 30684, 48, 8); int K13[] = "The Triforce, I assume."; PlayTangoString(K13, STYLE_KELL, 30620, 48, 8); int A13[] = "No. The royal family of Hyrule is the bloodline of the goddess, Hylia. All females of our line possess limited healing powers. Though my mother saved me, sadly, she could not heal the wound in her heart. Something broke inside my mother that day. She brought me inside the castle and told me that she wouldn't allow the Hylians to hurt me ever again. And then, triforce in hand, she called down the waves."; PlayTangoString(A13, STYLE_ALIYA, 30684, 48, 8); int R8[] = "That was her!?"; PlayTangoString(R8, STYLE_RIGGS, 30464, 48, 8); int A14[] = "Yes. There was a day, long ago, when she let her heart guide her decisions. Even then, in drowning Hyrule and its culture, she hoped to cultivate a new society above the waves, one without the prejudices of their fathers. You already know how that experiment ended."; PlayTangoString(A14, STYLE_ALIYA, 30684, 48, 8); int K8[] = "With a screaming child, burning alive."; PlayTangoString(K8, STYLE_KELL, 30620, 48, 8); int A15[] = "That was the last straw for her. For her and I both. We knew then that there was no hope for the Hylians. She wished for punishment, and I for the wellbeing of my race. For the good of the Gerudo, they had to be extinguished."; PlayTangoString(A15, STYLE_ALIYA, 30684, 48, 8); int R9[] = "I don't get it. What changed now?"; PlayTangoString(R9, STYLE_RIGGS, 30464, 48, 8); int A16[] = "As of now, nothing. Yet... I sense a possibility I may have overlooked. One which never occurred to my mother, and one which I doubt ever will."; PlayTangoString(A16, STYLE_ALIYA, 30684, 48, 8); int K9[] = "And that is?"; PlayTangoString(K9, STYLE_KELL, 30620, 48, 8); int A17[] = "For now, I cannot say. But if you truly wish to save the Hylians, the source of the curse is in the next room."; PlayTangoString(A17, STYLE_ALIYA, 30684, 48, 8); int K10[] = "What's so special about that room?"; PlayTangoString(K10, STYLE_KELL, 30620, 48, 8); int A18[] = "It's the throne room."; PlayTangoString(A18, STYLE_ALIYA, 30684, 48, 8); int R10[] = "Zelda... she's the source of the curse, isn't she? That's why you brought us here."; PlayTangoString(R10, STYLE_RIGGS, 30464, 48, 8); int K11[] = "I still don't understand. Why tell us this? Why send us in to face your mother and dispel this curse if you don't agree with what we're doing?"; PlayTangoString(K11, STYLE_KELL, 30620, 48, 8); int A19[] = "I don't expect you to understand... but I need to know."; PlayTangoString(A19, STYLE_ALIYA, 30684, 48, 8); int R11[] = "To know what!?"; PlayTangoString(R11, STYLE_RIGGS, 30464, 48, 8); int A20[] = "Everything I do, I do for the sake of the Gerudo. Even this."; PlayTangoString(A20, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5052; while(Aliya->Y > -16){ Aliya->Y--; Wait(); } Aliya->Data = 0; Wait(60); int R12[] = "I don't get it."; PlayTangoString(R12, STYLE_RIGGS, 30464, 48, 8); int K12[] = "Nor do I, but I suspect there is more to her relationship with Zelda than she is letting on. Before we go in there, we need to be ready. If there's anything else you think we should do, now's the time."; PlayTangoString(K12, STYLE_KELL, 30620, 48, 8); G[G_PREZELDASCENE] = 1; } if(scene == 22 && Game->GetCurScreen() == 0x52){ G[G_ZELDAMIDPOINT] = 0; MoveLinkUp(-1); } if(scene == 22 && Game->GetCurScreen() == 0x42){ if(G[G_ZELDAMIDPOINT] == 1 && G[G_RANDO] == 0){ Waitframe(); CreateNPCAt(299, 120, 48); G[G_ALIYAINPARTY] = 1; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 203 || G[i] == 205 || G[i] == 206 || G[i] == 207){ G[i] = 216; } } ItemIDs[0] = 216; ItemTiles[0] = 30700; ItemCSets[0] = 8; Link->Item[RING_ALIYA] = true; ffc Riggs = FindFreeFFC(); Riggs->Data = 5086; Riggs->CSet = 6; Riggs->X = 208; Riggs->Y = 112; SetLayerComboD(1, ComboAt(48, 32), 0); Quit(); } if(G[G_ZELDAMIDPOINT] == 1 && G[G_RANDO] == 1){ SetLayerComboD(1, ComboAt(48, 32), 0); CreateNPCAt(299, 120, 48); Quit(); } ffc Zelda = Screen->LoadFFC(3); Zelda->Data = 5065; Zelda->X = 120; Zelda->Y = 48; Zelda->CSet = 9; ffc Aliya = Screen->LoadFFC(2); Aliya->Data = 5049; Aliya->CSet = 6; Aliya->X = 48; Aliya->Y = 32; if(G[G_RANDO] == 1){ Aliya->Data = 0; SetLayerComboD(1, ComboAt(48, 32), 0); } MoveLinkUp(112); if(G[G_PREZELDASCENETWO] == 0){ ffc Kell = FindFreeFFC(); Kell->Data = 5030; Kell->CSet = 6; Kell->X = Link->X; Kell->Y = Link->Y; ffc Riggs = FindFreeFFC(); Riggs->Data = 5039; Riggs->CSet = 6; Riggs->X = Link->X; Riggs->Y = Link->Y; for(int i = 0; i<8; i++){ Kell->X--; Riggs->X++; WaitI(); } Kell->Data = 5024; Riggs->Data = 5032; WaitI(60); int Z1[] = "Welcome, Prince Kell of the Zora and Prince Riggs of the Gerudo. I am Zelda, queen of the Hylians."; PlayTangoStringI(Z1, STYLE_ZELDA, 30800, 48, 8); int K1[] = "It is an honor, though I wish our meeting were not under such circumstances."; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); int Z2[] = "Indeed. My daughter has informed me of your movements and your intentions."; PlayTangoStringI(Z2, STYLE_ZELDA, 30800, 48, 8); int R1[] = "And she's told us about yours. But I don't get it. Why are you on board with murdering the Hylians? They're your own people!"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); int Z3[] = "Correct. That is precisely why I must do this. As the physical incarnation of Hylia, it is my responsibility to tend to my people. To guide them, nurture them when they are young, correct them when they go astray, and punish them when they commit atrocities."; PlayTangoStringI(Z3, STYLE_ZELDA, 30800, 48, 8); int K2[] = "I was unaware murder counted as 'correction'."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int Z4[] = "I've tried to correct their ways already. I flooded their kingdom and offered them a new start, a chance to turn away from the crimes of their fathers and be better. They firmly rejected that offer."; PlayTangoStringI(Z4, STYLE_ZELDA, 30800, 48, 8); int R2[] = "I thought Aliya was crazy. But you're somehow worse. You think this is an acceptable punishment? Killing an entire race?"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int Z5[] = "Does that disturb you, child? Such is simply the way of the world. The Hylians are far from the first race to face divine judgment for their actions."; PlayTangoStringI(Z5, STYLE_ZELDA, 30800, 48, 8); int K3[] = "Divine judgment? There's nothing divine about this. All you're seeking is revenge."; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int Z6[] = "And I am entirely within my right to do so. They are a wicked race who have transgressed against the laws of morality time and time again."; PlayTangoStringI(Z6, STYLE_ZELDA, 30800, 48, 8); int R3[] = "Aliya, you're not on board with this, are you? You told us you're only doing everything to protect the Gerudo. This isn't protecting us! This is a vendetta!"; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int A1[] = "My mother has her reasons for acting, and I have mine. So long as there is no other way of ensuring the safety of the Gerudo, our goals are aligned."; PlayTangoStringI(A1, STYLE_ALIYA, 30684, 48, 8); int Z7[] = "Your dedication to your cause is admirable, but misguided. The Hylians' course was set many decades ago, and I will not allow it to be changed now."; PlayTangoStringI(Z7, STYLE_ZELDA, 30800, 48, 8); int K4[] = "And if we contest that?"; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int Z8[] = "Then your fate will be the same as theirs."; PlayTangoStringI(Z8, STYLE_ZELDA, 30800, 48, 8); int K5[] = "And you don't feel any remorse about that?"; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int Z9[] = "Those who side with wickedness will reap what they sow."; PlayTangoStringI(Z9, STYLE_ZELDA, 30800, 48, 8); int K6[] = "Is this why you brought us here, Aliya? So your mother could do what you couldn't?"; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int A2[] = "I have my goals, Kell. You and Riggs have yours. This is where they've brought us."; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); int K7[] = "How vague."; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); int R4[] = "Don't worry about her, Kell. I've got a good feeling about this."; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); int K8[] = "A good feeling?"; PlayTangoStringI(K8, STYLE_KELL, 30620, 48, 8); int R5[] = "I can't explain it. Just trust me on this."; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); int K9[] = "I don't exactly have much of a choice. I haven't come this far to back down now. Even if that means regicide."; PlayTangoStringI(K9, STYLE_KELL, 30620, 48, 8); int Z10[] = "What a shame. I had hoped for more from you two."; PlayTangoStringI(Z10, STYLE_ZELDA, 30800, 48, 8); Kell->Data = 5031; Riggs->Data = 5038; for(int i = 0; i<8; i++){ Kell->X++; Riggs->X--; WaitI(); } Kell->Data = 0; Riggs->Data = 0; //0D 24 G[G_PREZELDASCENETWO] = 1; } CreateNPCAt(299, Zelda->X, Zelda->Y); Zelda->Data = 0; } if(scene == 23 && Game->GetCurScreen() == 0x42){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; Game->PlaySound(112); Game->PlaySound(113); ffc Zelda = Screen->LoadFFC(3); // npc n = Screen->LoadNPC(1); // Zelda->X = n->X; // Zelda->Y = n->Y; Zelda->Data = 5068 + AngleDir4(Angle(Zelda->X, Zelda->X, Link->X, Link->Y)); Zelda->CSet = 9; // n->X = 300; ffc Aliya = Screen->LoadFFC(2); Link->CollDetection = false; ffc Kell = FindFreeFFC(); Kell->Data = 5046; Kell->CSet = 6; Kell->X = Link->X-8; Kell->Y = Link->Y; ffc Riggs = FindFreeFFC(); Riggs->Data = 5047; Riggs->CSet = 6; Riggs->X = Link->X+8; Riggs->Y = Link->Y; WaitI(60); int Z1[] = "Such a disappointment."; PlayTangoStringI(Z1, STYLE_ZELDA, 30800, 48, 8); Kell->Data = 5027; int K1[] = "Riggs, are you-"; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); Zelda->Data += 4; while(Distance(Zelda->X, Zelda->Y, Kell->X, Kell->Y) > 4){ Zelda->X += VectorX(3, Angle(Zelda->X, Zelda->Y, Kell->X, Kell->Y)); Zelda->Y += VectorY(3, Angle(Zelda->X, Zelda->Y, Kell->X, Kell->Y)); WaitI(); } Zelda->Data = 5078; Kell->Data = 5084; Game->PlaySound(19); while(Kell->X > 32){ Kell->X-=2; WaitI(); } Kell->Data = 5085; WaitI(10); Zelda->Data = 5079; Riggs->Data = 5034; for(int i = 0; i<4; i++){ Zelda->X+=2; WaitI(); } Game->PlaySound(19); while(Riggs->X < 208){ Zelda->X+=2; Riggs->X+=2; WaitI(); } Zelda->Data = 5075; for(int i = 0; i<8; i++){ Zelda->X--; WaitI(); } Zelda->Data = 5079; Game->PlaySound(30); Game->PlayMIDI(0); for(int i = 0; i<60; i++){ Screen->FastCombo(2, Zelda->X +13, Zelda->Y + 2, 5094, 11, OP_OPAQUE); WaitI(); } Zelda->Data = 5071; WaitI(30); Game->PlaySound(113); Riggs->Data = 5086; WaitI(60); Zelda->Data = 5072 + AngleDir4(Angle(Zelda->X, Zelda->Y, 120, 48)); while(Distance(Zelda->X, Zelda->Y, 120, 48) > 2){ Zelda->X += VectorX(1, Angle(Zelda->X, Zelda->Y, 120, 48)); Zelda->Y += VectorY(1, Angle(Zelda->X, Zelda->Y, 120, 48)); WaitI(); } Zelda->Data = 5069; Kell->Data = 5027; int K2[] = "Riggs!"; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); Kell->Data = 5031; while(Kell->X < Riggs->X - 16){ Kell->X +=2; WaitI(); } Kell->Data = 5027; WaitI(30); int K3[] = "Riggs! Are you alright!?"; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); WaitI(60); int K4[] = "Riggs! Say something!"; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); WaitI(60); int Z2[] = "Screaming louder won't make a dead man hear you any more clearly."; PlayTangoStringI(Z2, STYLE_ZELDA, 30800, 48, 8); int K5[] = "Riggs! Get up, please! Please..."; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int A1[] = "Kell, he's-"; PlayTangoStringI(A1, STYLE_ALIYA, 30684, 48, 8); Kell->Data = 5026; int K6[] = "Bring him back!"; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int A2[] = "Pardon?"; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); int K7[] = "You said your bloodline has healing powers. Bring him back!"; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); WaitI(60); int K8[] = "What are you waiting for!? I'll do anything! You want to kill the Hylians? Fine! We'll leave you alone. We'll go far away, where you never have to see us again. You can do whatever you want! Just don't let him die!"; PlayTangoStringI(K8, STYLE_KELL, 30620, 48, 8); WaitI(60); int A3[] = "... I have my answer."; PlayTangoStringI(A3, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5052 + AngleDir4(Angle(Aliya->X, Aliya->Y, Kell->X-16, Kell->Y)); while(Distance(Aliya->X, Aliya->Y, Kell->X-16, Kell->Y) > 2){ Aliya->X += VectorX(1, Angle(Aliya->X, Aliya->Y, Kell->X-16, Kell->Y)); Aliya->Y += VectorY(1, Angle(Aliya->X, Aliya->Y, Kell->X-16, Kell->Y)); WaitI(); } Aliya->Data = 5051; int Music[] = "R6 - Final Boss 3.nsf"; Game->PlayEnhancedMusic(Music, 0); int A4[] = "Dry your tears, Kell. He will live."; PlayTangoStringI(A4, STYLE_ALIYA, 30684, 48, 8); int K9[] = "You'll... you'll save him?"; PlayTangoStringI(K9, STYLE_KELL, 30620, 48, 8); int A5[] = "Yes. But there is something we must do first."; PlayTangoStringI(A5, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5048; WaitI(30); int A6[] = "Mother! The curse ends here, and now!"; PlayTangoStringI(A6, STYLE_ALIYA, 30684, 48, 8); int Z3[] = "I beg your pardon?"; PlayTangoStringI(Z3, STYLE_ZELDA, 30800, 48, 8); int A7[] = "You and I no longer share a goal. Dispel the curse, or I promise you, I will strike you down where you stand."; PlayTangoStringI(A7, STYLE_ALIYA, 30684, 48, 8); int Z4[] = "After all I've done for you, you would betray your own mother and side with these wicked creatures? ... If that is how it must be, then so be it."; PlayTangoStringI(Z4, STYLE_ZELDA, 30800, 48, 8); int A8[] = "There was a time when I looked up to you. You were everything I aspired to be. But the person I looked up to died long ago. You're nothing but a shell of her. Mother... allow me to give you the rest you deserve."; PlayTangoStringI(A8, STYLE_ALIYA, 30684, 48, 8); int K10[] = "I don't understand, Aliya."; PlayTangoStringI(K10, STYLE_KELL, 30620, 48, 8); int A9[] = "As I said earlier, there was something I needed to know. You have given me my answer. Now come. Finish what you started."; PlayTangoStringI(A9, STYLE_ALIYA, 30684, 48, 8); Kell->Data = 5030; while(Kell->X > Aliya->X){ Kell->X--; WaitI(); } Link->X = Aliya->X; Link->Y = Aliya->Y; Link->Item[RING_ALIYA] = true; Link->Item[RING_RIGGS] = false; Aliya->Data = 0; Kell->Data = 0; Zelda->Data = 0; G[G_ALIYAINPARTY] = 1; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 203 || G[i] == 205 || G[i] == 206 || G[i] == 207){ G[i] = 216; } } ItemIDs[0] = 216; ItemTiles[0] = 30700; ItemCSets[0] = 8; Link->CollDetection = true; Link->HP = Link->MaxHP; G[G_ZELDAMIDPOINT] = 1; SetLayerComboD(1, ComboAt(48, 32), 0); } if(scene == 24){ G[G_HPDRAIN] = 0; G[G_SUPPRESSDAMAGENUMBERS] = 2; Wait(30); if(G[G_RANDO] == 0){ int Z1[] = "What do you think you've accomplished here, Aliya? The only way of saving the Gerudo was through me. By interfering in the righteous judgement of one race, you have just doomed your own."; PlayTangoString(Z1, STYLE_ZELDA, 30800, 48, 8); int A1[] = "We shall see, Mother."; PlayTangoString(A1, STYLE_ALIYA, 30684, 48, 8); } ffc Zelda; for(int i = 1; i<32; i++){ Zelda = Screen->LoadFFC(i); if(Zelda->CSet == 9 && Zelda->Data >= 5068 && Zelda->Data <= 5071) break; } lweapon explosion; // One explosion every 16 frames, 15 times for(int i=0; i<15; i++) { explosion=Screen->CreateLWeapon(LW_BOMBBLAST); explosion->X=Zelda->X+Rand(16)-8; explosion->Y=Zelda->Y+Rand(16)-8; explosion->CollDetection=false; for(int j=0; j<16; j++) { // Ghost_SetPosition(this, ghost); // Make sure it doesn't wander off // Ghost_WaitframeLight(this, ghost); Wait(); } } Zelda->Data = 0; ffc Triforce = FindFreeFFC(); Triforce->Data = 5087; Triforce->CSet = 5; Triforce->X = Zelda->X-8; Triforce->Y = Zelda->Y-8; Triforce->TileWidth = 2; Triforce->TileHeight = 2; if(G[G_RANDO] == 1){ Wait(60); while(Distance(Triforce->X, Triforce->Y,112, 24) > 2){ Triforce->X += VectorX(1, Angle(Triforce->X, Triforce->Y,112, 24)); Triforce->Y += VectorY(1, Angle(Triforce->X, Triforce->Y,112, 24)); Wait(); } if(Link->Y < 56) MoveLinkDown(56); if(Link->X < 120) MoveLinkRight(120); if(Link->X > 120) MoveLinkLeft(120); if(Link->Y > 56) MoveLinkUp(56); ffc Holdup = FindFreeFFC(); Holdup->X = Link->X; Holdup->Y = Link->Y; Holdup->CSet = 6; Holdup->Data = 5092; if(Link->Item[RING_RIGGS]) Holdup->Data = 5096; int Music2[] = "R6 - Z1.nsf"; Game->PlayEnhancedMusic(Music2, 22); int XPos = Triforce->X + 8; int YPos = Triforce->Y + 8; for(int i = 0; i<360; i++){ int Dist = i/4; int Color = Choose(0x25, 0x26, 0x27); Screen->Circle(4, XPos+8+Rand(-2,2), YPos+8+Rand(-2,2), Rand(-2,2)+Dist, Color, 1, 0, 0, 0, true, OP_TRANS); if(Dist>16)Screen->Circle(4, XPos+8+Rand(-2,2), YPos+8+Rand(-2,2), Rand(-2,2)+Dist-16, Color, 1, 0, 0, 0, true, OP_OPAQUE); WaitI(); } this->Data = CMB_AUTOWARPA + 2; } // } // if(scene == 25){ Game->PlayMIDI(0); if(Link->Y < 48) MoveLinkDown(48); ffc Riggs; for(int i = 1; i<32; i++){ Riggs = Screen->LoadFFC(i); if(Riggs->Data == 5086) break; } // ffc Triforce; // for(int i = 1; i<32; i++){ // Triforce = Screen->LoadFFC(i); // if(Triforce->Data == 5087) // break; // } Wait(60); while(Distance(Triforce->X, Triforce->Y,112, 24) > 2){ Triforce->X += VectorX(1, Angle(Triforce->X, Triforce->Y,112, 24)); Triforce->Y += VectorY(1, Angle(Triforce->X, Triforce->Y,112, 24)); Wait(); } ffc Aliya = FindFreeFFC(); Aliya->Data = 5052; Aliya->CSet = 6; Aliya->X = Link->X; Aliya->Y = Link->Y; ffc Kell = FindFreeFFC(); Kell->Data = 5024; Kell->CSet = 6; Aliya->X = Link->X; Aliya->Y = Link->Y; if(Link->Item[RING_ALIYA]){ Kell->Data = 4241; Aliya->Data += AngleDir4(Angle(Aliya->X, Aliya->Y, Riggs->X-16, Riggs->Y)); } else{ Aliya->Data = 4241; Kell->Data += AngleDir4(Angle(Kell->X, Kell->Y, Riggs->X-16, Riggs->Y)); } while(Distance(Aliya->X, Aliya->Y, Riggs->X-16, Riggs->Y) > 2){ Aliya->X += VectorX(1, Angle(Aliya->X, Aliya->Y, Riggs->X-16, Riggs->Y)); Aliya->Y += VectorY(1, Angle(Aliya->X, Aliya->Y, Riggs->X-16, Riggs->Y)); Kell->X = Aliya->X; Kell->Y = Aliya->Y; WaitI(); } Kell->Data = 5027; Aliya->Data = 5053; for(int i = 0; i<16; i++){ Aliya->Y++; WaitI(); } Aliya->Data = 5055; for(int i = 0; i<16; i++){ Aliya->X++; WaitI(); } Aliya->Data = 5048; WaitI(30); int K1[] = "You can heal him, right? He's going to be alright?"; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); int AX[] = "This will take a moment, but yes, he will be fine."; PlayTangoStringI(AX, STYLE_ALIYA, 30684, 48, 8); int K2[] = "Thank you..."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); Aliya->Data = 5067; WaitI(60); int K3[] = "I still don't understand. You were adamant that the Hylians had to die. What changed?"; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int A2[] = "I have little sympathy for the Hylians... but that does not mean they deserved to die. On that point, my mother and I disagreed. However, I saw no way for the Hylians and Gerudo to co-exist."; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); int K4[] = "And seeing your mother try to kill Riggs somehow changed that?"; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int A3[] = "No. Seeing you changed that."; PlayTangoStringI(A3, STYLE_ALIYA, 30684, 48, 8); int K5[] = "I don't follow."; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int A4[] = "The Gerudo are an unlovable race. My parents, for all their noble intentions, never had anything more than mutual respect. If the most the other races could muster was a begrudging tolerance, the Gerudo would have no future."; PlayTangoStringI(A4, STYLE_ALIYA, 30684, 48, 8); int K6[] = "Oh... You mean..."; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int A5[] = "When I met you, I sensed something different. I didn't sense hate from you towards me. You were even willing to spare me, despite the circumstances. And through all this, you had your friendship with Riggs. I had to know how far that extended. If a Zora prince could set aside centuries of history and truly care for a Gerudo... then perhaps there was a way."; PlayTangoStringI(A5, STYLE_ALIYA, 30684, 48, 8); int K7[] = "You intended for all this to happen?"; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); int A6[] = "I told Mother that Riggs was exceptionally dangerous and would need to be taken care of first. I apologize... but I had to know how far you were willing to go."; PlayTangoStringI(A6, STYLE_ALIYA, 30684, 48, 8); int K8[] = "... I can't say I'm happy with it, but I understand."; PlayTangoStringI(K8, STYLE_KELL, 30620, 48, 8); int A7[] = "I am less than thrilled myself. Part of me had hoped that, confronted with the prospect of killing an innocent boy like Riggs, my mother would see the error in her ways. That... did not come to pass. She was simply too far gone."; PlayTangoStringI(A7, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5048; int A8[] = "There. It is done."; PlayTangoStringI(A8, STYLE_ALIYA, 30684, 48, 8); Aliya->Data = 5088; Game->PlaySound(111); int K9[] = "Aliya! What's wrong?"; PlayTangoStringI(K9, STYLE_KELL, 30620, 48, 8); int A9[] = "Heh... I never was as talented as Mother was. Riggs will be fine... but I can't say the same for myself."; PlayTangoStringI(A9, STYLE_ALIYA, 30684, 48, 8); Riggs->Data = 5089; WaitI(30); Riggs->Data = 5090; WaitI(10); Riggs->Data = 5091; WaitI(10); Riggs->Data = 5034; WaitI(20); int R1[] = "Yeowch... I can't remember the last time my head hurt this much. What'd I miss?"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); Riggs->Data = 5033; WaitI(30); int R2[] = "Aliya? You're bleeding!"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int A10[] = "Do not fret over me. I've cheated death once before. So long as it accomplishes something worthwhile this time, I have no qualms dying here. There remains but one matter to take care of first."; PlayTangoStringI(A10, STYLE_ALIYA, 30684, 48, 8); int K10[] = "The Triforce your mother left behind."; PlayTangoStringI(K10, STYLE_KELL, 30620, 48, 8); int A11[] = "Indeed. It can grant wishes, but sadly, it cannot do the impossible. You won't be able to wish away prejudice, but I trust you two can make use of its power wisely."; PlayTangoStringI(A11, STYLE_ALIYA, 30684, 48, 8); Kell->Data = 5030; Riggs->Data = 5038; while(Kell->X > 120){ Kell->X--; Riggs->X--; WaitI(); } Kell->Data = 5028; for(int i = 0; i<16; i++){ Kell->Y--; Riggs->X--; WaitI(); } Riggs->Data = 5036; while(Kell->Y > 56){ Kell->Y--; Riggs->Y--; WaitI(); } Kell->Data = 5024; Riggs->Data = 5032; WaitI(30); int K11[] = "We're lucky then. I'm not wishing for anything impossible."; PlayTangoStringI(K11, STYLE_KELL, 30620, 48, 8); Kell->Data = 5028; while(Kell->Y > 48){ Kell->Y--; WaitI(); } Kell->Data = 5092; Triforce->Y -= 8; WaitI(60); int K12[] = "I wish for this curse to be dispelled once and for all, and that Aliya would be healed of her wounds, so that she might see the world she only dreamed of - a world where the Gerudo and the other races live together peacefully - come to exist within her lifetime."; PlayTangoStringI(K12, STYLE_KELL, 30620, 48, 8); int Music2[] = "R6 - Z1.nsf"; Game->PlayEnhancedMusic(Music2, 22); int XPos = Triforce->X + 8; int YPos = Triforce->Y + 8; for(int i = 0; i<360; i++){ int Dist = i/4; int Color = Choose(0x25, 0x26, 0x27); Screen->Circle(4, XPos+8+Rand(-2,2), YPos+8+Rand(-2,2), Rand(-2,2)+Dist, Color, 1, 0, 0, 0, true, OP_TRANS); if(Dist>16)Screen->Circle(4, XPos+8+Rand(-2,2), YPos+8+Rand(-2,2), Rand(-2,2)+Dist-16, Color, 1, 0, 0, 0, true, OP_OPAQUE); WaitI(); } this->Data = CMB_AUTOWARPA + 3; } if(scene == 26){ if(G[G_ALIYAINPARTY] == 1){ G[G_ALIYAINPARTY] = 0; Link->Item[RING_ALIYA] = false; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 216){ if(Link->Item[205]) G[i] = 205; else G[i] = 203; } } if(Link->Item[205]){ ItemIDs[0] = 205; ItemTiles[0] = 19780; ItemCSets[0] = 7; } else{ ItemIDs[0] = 203; ItemTiles[0] = 19761; ItemCSets[0] = 7; } } WaitI(60); int A1[] = "!!!"; PlayTangoStringI(A1, STYLE_ALIYA, 30684, 48, 8); ffc Aliya = Screen->LoadFFC(3); Aliya->Data = 5048; int A2[] = "Kell! You shouldn't have wasted that on me! Think of what you might have done with the Triforce!"; PlayTangoStringI(A2, STYLE_ALIYA, 30684, 48, 8); int K2[] = "Don't worry, I didn't need it."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int A3[] = "How can you be so cocky?"; PlayTangoStringI(A3, STYLE_ALIYA, 30684, 48, 8); int R1[] = "I'm a little confused myself, Kell. I mean, I'm all for taking on the world, but you seem awfully sure of yourself."; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); int K3[] = "You told me yourself, Aliya. The Triforce can't do the impossible. I asked it to heal you if you could see the world you wish for before you die. It wouldn't have granted that wish if that weren't achievable in our lifetime."; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int R2[] = "Oh! That's genius!"; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int A4[] = "I suppose it is... Thank you, Kell."; PlayTangoStringI(A4, STYLE_ALIYA, 30684, 48, 8); int R3[] = "What are you gonna do now, Aliya?"; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int A5[] = "I doubt the Hylians would be very welcoming of me, so for now, I suppose I will go into exile."; PlayTangoStringI(A5, STYLE_ALIYA, 30684, 48, 8); int K4[] = "You never know. They might be quicker to forgive than you realize."; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); int A6[] = "We shall see. I expect the three of us shall meet again."; PlayTangoStringI(A6, STYLE_ALIYA, 30684, 48, 8); int R4[] = "Until then, stay safe! Try not to start any more genocidal curses in the meantime."; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); int A7[] = "Heh... I shall try, Riggs."; PlayTangoStringI(A7, STYLE_ALIYA, 30684, 48, 8); this->Data = CMB_AUTOWARPA; } if(scene == 27){ WaitI(60); int A1[] = "Incredible. To think, all this time, Zelda was the one who flooded Hyrule and sought our deaths."; PlayTangoStringI(A1, STYLE_OTHER, 84, 48, 8); int K1[] = "Even the best of us can go down a dark road."; PlayTangoStringI(K1, STYLE_KELL, 30620, 48, 8); int R1[] = "You will let everyone know, right?"; PlayTangoStringI(R1, STYLE_RIGGS, 30464, 48, 8); int A2[] = "Of course. I can't promise you everyone will believe me, but I will make sure that all who pass through here know of the true history of Hyrule, and of the innocence of the Gerudo."; PlayTangoStringI(A2, STYLE_OTHER, 84, 48, 8); ffc Abei = Screen->LoadFFC(4); Abei->Data = 3336; while(Abei->Y > -16){ Abei->Y--; WaitI(); } Abei->Data = 0; ffc Kell = Screen->LoadFFC(1); Kell->Data = 5026; ffc Riggs = Screen->LoadFFC(3); Riggs->Data = 5035; WaitI(60); int R2[] = "So... I guess that's it then."; PlayTangoStringI(R2, STYLE_RIGGS, 30464, 48, 8); int K2[] = "Indeed... we did it. I suppose that means you're going to see about making things better for the rest of the Gerudo now."; PlayTangoStringI(K2, STYLE_KELL, 30620, 48, 8); int R3[] = "I guess so. And you're heading back home?"; PlayTangoStringI(R3, STYLE_RIGGS, 30464, 48, 8); int K3[] = "The Prince can't stay gone forever. I should at least make sure everything's fine at home, and see if there's anything we can do to help the Gerudo."; PlayTangoStringI(K3, STYLE_KELL, 30620, 48, 8); int R4[] = "Right, of course. I guess I'll be seeing you around then."; PlayTangoStringI(R4, STYLE_RIGGS, 30464, 48, 8); int K4[] = "Take care, Riggs."; PlayTangoStringI(K4, STYLE_KELL, 30620, 48, 8); Kell->Data = 5093; for(int i = 0; i<32; i++){ if(i%2 == 0) Kell->X++; WaitI(); } Kell->Data = 5026; int K5[] = "Before I go, can I ask a favor of you?"; PlayTangoStringI(K5, STYLE_KELL, 30620, 48, 8); int R5[] = "Sure thing! What is it?"; PlayTangoStringI(R5, STYLE_RIGGS, 30464, 48, 8); int K6[] = "Do you think... if it's not too much trouble... maybe you could hold on to the Zora's Sapphire for me?"; PlayTangoStringI(K6, STYLE_KELL, 30620, 48, 8); int R6[] = "Huh? Why would- oh! Of course! I'd be happy to. Just make sure you come back for it at some point."; PlayTangoStringI(R6, STYLE_RIGGS, 30464, 48, 8); int K7[] = "Don't worry. I'll make sure of it. Until we meet again, Riggs."; PlayTangoStringI(K7, STYLE_KELL, 30620, 48, 8); this->Data = CMB_AUTOWARPA; } } } const int C_FALLING_SPEEDLINE = 0x01; void BlackScreenLayerSix(){ Screen->Rectangle(6, -64, -64, 300, 200, 0x00, 1, 0, 0, 0, true, OP_OPAQUE); } void MoveLinkUp(int y){ while(Link->Y > y){ Link->InputUp = true; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Link->PressA = false; Link->PressB = false; Link->PressL = false; Link->PressR = false; Waitframe(); } } void MoveLinkDown(int y){ while(Link->Y < y){ Link->InputUp = false; Link->InputDown = true; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Link->PressA = false; Link->PressB = false; Link->PressL = false; Link->PressR = false; Waitframe(); } } void MoveLinkLeft(int x){ while(Link->X > x){ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = true; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Link->PressA = false; Link->PressB = false; Link->PressL = false; Link->PressR = false; Waitframe(); } } void MoveLinkRight(int x){ while(Link->X < x){ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = true; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Link->PressA = false; Link->PressB = false; Link->PressL = false; Link->PressR = false; Waitframe(); } } ffc script TitleScreen{ void run(){ bool Rando; while(true){ Screen->DrawCombo(6, 73, 156, 5012, 4, 1, 6, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); DrawTitleScreen(); if((Link->PressL || Link->InputL) && (Link->PressEx2 || Link->InputEx2) && Link->PressStart){ Rando = true; Game->PlaySound(27); DrawTitleScreen(); break; } if(Link->PressStart){ Game->PlaySound(21); DrawTitleScreen(); break; } } // if(Rando) // Game->PlaySound(27); // else // Game->PlaySound(12); int EasyMode[16] = "Relaxed"; int NormalMode[16] = "Easy"; int DifficultMode[16] = "Normal"; int Options[16] = "Insane"; int AbsurdMode[16] = "Hard"; int pressdelay; int xanchor = 84; int yanchor = 120; int position = 1; for(int i = 0; i<30; i++) DrawTitleScreen(); int color = 0x01; while(true){ if(pressdelay > 0) pressdelay--; // if(CountFFCsRunning(133)== 0){ if(Link->PressDown && position <3){ position++; Game->PlaySound(5); } else if(Link->PressUp && position > -1){ position--; Game->PlaySound(5); } DrawTile(4, xanchor-3, yanchor+15+position*8, 5, 1, 1, 0, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor, FONT_Z3SMALL , color, 0, TF_NORMAL, EasyMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+8, FONT_Z3SMALL , color, 0, TF_NORMAL, NormalMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+16, FONT_Z3SMALL , color, 0, TF_NORMAL, DifficultMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+24, FONT_Z3SMALL , color, 0, TF_NORMAL, AbsurdMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+32, FONT_Z3SMALL , color, 0, TF_NORMAL, Options, OP_OPAQUE); if(pressdelay == 0 && (Link->PressStart || Link->PressA)){ if(position == -1){ Game->PlaySound(25); G[G_DIFFICULTY] = DIF_VEASY; for(int i = 30; i >0; i--){ DrawTile(1, xanchor-3, yanchor+15+position*8, 5, 1, 1, 0, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor, FONT_Z3SMALL , color, 0, TF_NORMAL, EasyMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+8, FONT_Z3SMALL , color, 0, TF_NORMAL, NormalMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+16, FONT_Z3SMALL , color, 0, TF_NORMAL, DifficultMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+24, FONT_Z3SMALL , color, 0, TF_NORMAL, AbsurdMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+32, FONT_Z3SMALL , color, 0, TF_NORMAL, Options, OP_OPAQUE); DrawTitleScreen(); } break; } if(position == 0){ Game->PlaySound(25); G[G_DIFFICULTY] = DIF_EASY; for(int i = 30; i >0; i--){ DrawTile(1, xanchor-3, yanchor+15+position*8, 5, 1, 1, 0, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor, FONT_Z3SMALL , color, 0, TF_NORMAL, EasyMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+8, FONT_Z3SMALL , color, 0, TF_NORMAL, NormalMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+16, FONT_Z3SMALL , color, 0, TF_NORMAL, DifficultMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+24, FONT_Z3SMALL , color, 0, TF_NORMAL, AbsurdMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+32, FONT_Z3SMALL , color, 0, TF_NORMAL, Options, OP_OPAQUE); DrawTitleScreen(); } break; } if(position ==1){ Game->PlaySound(25); G[G_DIFFICULTY] = DIF_NORMAL; for(int i = 16; i >0; i--){ DrawTile(1, xanchor-3, yanchor+15+position*8, 5, 1, 1, 0, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor, FONT_Z3SMALL , color, 0, TF_NORMAL, EasyMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+8, FONT_Z3SMALL , color, 0, TF_NORMAL, NormalMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+16, FONT_Z3SMALL , color, 0, TF_NORMAL, DifficultMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+24, FONT_Z3SMALL , color, 0, TF_NORMAL, AbsurdMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+32, FONT_Z3SMALL , color, 0, TF_NORMAL, Options, OP_OPAQUE); DrawTitleScreen(); } break; } if(position ==2){ Game->PlaySound(25); G[G_DIFFICULTY] = DIF_HARD; Link->Item[152] = true; for(int i = 16; i >0; i--){ DrawTile(1, xanchor-3, yanchor+15+position*8, 5, 1, 1, 0, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor, FONT_Z3SMALL , color, 0, TF_NORMAL, EasyMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+8, FONT_Z3SMALL , color, 0, TF_NORMAL, NormalMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+16, FONT_Z3SMALL , color, 0, TF_NORMAL, DifficultMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+24, FONT_Z3SMALL , color, 0, TF_NORMAL, AbsurdMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+32, FONT_Z3SMALL , color, 0, TF_NORMAL, Options, OP_OPAQUE); DrawTitleScreen(); } break; } if(position ==3){ Game->PlaySound(25); G[G_DIFFICULTY] = DIF_VHARD; for(int i = 16; i >0; i--){ DrawTile(1, xanchor-3, yanchor+15+position*8, 5, 1, 1, 0, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor, FONT_Z3SMALL , color, 0, TF_NORMAL, EasyMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+8, FONT_Z3SMALL , color, 0, TF_NORMAL, NormalMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+16, FONT_Z3SMALL , color, 0, TF_NORMAL, DifficultMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+24, FONT_Z3SMALL , color, 0, TF_NORMAL, AbsurdMode, OP_OPAQUE); Screen->DrawString(4, xanchor, yanchor+32, FONT_Z3SMALL , color, 0, TF_NORMAL, Options, OP_OPAQUE); DrawTitleScreen(); } break; } } // } DrawTitleScreen(); } ffc f = Screen->LoadFFC(2); f->Script = 8; f->InitD[0] = 1; if(Rando == true) f->InitD[1] = 1; } void DrawTitleScreen(){ Screen->DrawScreen(1, 11, 0x00, 0, 0, 0); Screen->DrawTile(1, 0, 16, 62540, 14, 6, 7, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); WaitI(); } } ffc script DigDog{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); // Ghost_SetFlag(GHF_8WAY); Ghost_Transform(this, ghost, 6144, 10, 2, 2); int vars[] = {Ghost_HP}; int counter = -1; int fireballcounter = 90; int stopcounter = 300; if(ghost->Attributes[9] == 0){ while(true){ counter = Ghost_ConstantWalk8(counter, 50, 10, 24, 0); if(fireballcounter > 0) fireballcounter--; else{ fireballcounter = 90; eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X + 8, Ghost_Y + 8, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); } if(stopcounter > 0) stopcounter--; else{ stopcounter = 300; DigDog_Waitframes(this, ghost, vars, 30); for(int i = 0; i<10; i++){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X + 8, Ghost_Y + 8, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); DigDog_Waitframes(this, ghost, vars, 3); } DigDog_Waitframes(this, ghost, vars, 45); for(int i = -60; i<=60; i+=30){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X + 8, Ghost_Y + 8, DegtoRad(i), 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); } DigDog_Waitframes(this, ghost, vars, 180); } DigDog_Waitframe(this, ghost, vars); } } else if(ghost->Attributes[9] == 1){ int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); int angle=45+90*Rand(4); int step = 1.5; int xStep=step*Cos(angle); int yStep=step*Sin(angle); int timer; DigDog_Waitframes(this, ghost, vars, 60); while(true){ if(xStep<0){ if(!Ghost_CanMove(DIR_LEFT, -xStep, 3)) xStep*=-1; } else{ if(!Ghost_CanMove(DIR_RIGHT, xStep, 3)) xStep*=-1; } if(yStep<0){ if(!Ghost_CanMove(DIR_UP, -yStep, 3)) yStep*=-1; } else{ if(!Ghost_CanMove(DIR_DOWN, yStep, 3)) yStep*=-1; } if(timer>=0){ timer++; if(timer == 300) timer = -30; } if(timer < 0){ timer++; if(timer%3 == 0) eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X + 8, Ghost_Y + 8, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); } Ghost_MoveXY(xStep, yStep, 3); DigDog_Waitframe(this, ghost, vars); } } else if(ghost->Attributes[9] == 2){ int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); int timer; int WalkSpeed = 2; int TargetX; int TargetY; DigDog_Waitframes(this, ghost, vars, 60); while(true){ TargetX = Link->X; TargetY = Link->Y; timer = 0; while(Distance(Ghost_X+16, Ghost_Y+16, TargetX, TargetY) > 8 ){ int Angle = Angle(Ghost_X+16, Ghost_Y+16, TargetX, TargetY); Ghost_MoveAtAngle(Angle, WalkSpeed, 0); if(Sin(Angle) >=0 && !Ghost_CanMove(DIR_UP, VectorY(WalkSpeed, Angle),0)) break; if(Sin(Angle) <0 && !Ghost_CanMove(DIR_DOWN, VectorY(WalkSpeed, Angle),0)) break; if(Cos(Angle) >=0 && !Ghost_CanMove(DIR_RIGHT, VectorY(WalkSpeed, Angle),0)) break; if(Cos(Angle) <0 && !Ghost_CanMove(DIR_LEFT, VectorY(WalkSpeed, Angle),0)) break; timer++; if(timer > 90) break; DigDog_Waitframe(this, ghost, vars); } DigDog_Waitframes(this, ghost, vars, 30); if(Rand(0,2) == 0){ for(int i = 0; i<10; i++){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X + 8, Ghost_Y + 8, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); DigDog_Waitframes(this, ghost, vars, 3); } } DigDog_Waitframe(this, ghost, vars); } } } void DigDog_Waitframe(ffc this, npc ghost, int vars){ Ghost_Data = 6144 + AngleDir8(Angle(Ghost_X+16, Ghost_Y+16, Link->X, Link->Y)); if(Ghost_HP < vars[0]){ vars[0] = Ghost_HP; npc Kid = CreateNPCAt(ghost->Attributes[10], Ghost_X+8, Ghost_Y+8); Kid->Misc[2] = Angle(Link->X, Link->Y, Ghost_X+8, Ghost_Y+8); } if(!Ghost_Waitframe(this, ghost, false, false)){ Ghost_Explode(this, ghost); if(Game->GetCurMap() == 8){ int Music3[] = "Final Fantasy III (1990-04-27)(Square).nsf"; Game->PlayEnhancedMusic(Music3, 3); } Quit(); } } void DigDog_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iMisc[2]); Ghost_Vy = VectorY(2, ghost->Misc[2]); int CurHP = Ghost_HP; while(true){ Ghost_Data = 6152 + AngleDir8(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Vx = Clamp(Ghost_Vx+Sign(Link->X+8-Ghost_X+8)*0.1, -1.5, 1.5); Ghost_Vy = Clamp(Ghost_Vy+Sign(Link->Y+8-Ghost_Y+8)*0.1, -1.5, 1.5); if(Ghost_HP < CurHP){ Ghost_Vx = VectorX(2, Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)); Ghost_Vy = VectorY(2, Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)); CurHP = Ghost_HP; } Ghost_Waitframe(this, ghost, true, true); } } } //Modified from a ghost.zh function float GetThrowHeight(int startx, int starty, int endx, int endy, int step) { if(step<=0) return 1; float dist=Distance(startx, starty, endx, endy); if(dist<1) return 1; float travelTime=dist/step; float ret=0; // Every increase in velocity of GH_GRAVITY means two frames in the air. // This might overshoot by a frame, but that's all right. while(ret<=GH_TERMINAL_VELOCITY) { ret+=GH_GRAVITY; travelTime-=2; if(travelTime<=0) return ret; } // Needs to exceed terminal velocity. Slightly trickier here, because // an increase of GH_GRAVITY may mean more than two more frames in the air. float excess=0; // Distance left to fall after reaching TV while(travelTime>excess/GH_TERMINAL_VELOCITY) { ret+=GH_GRAVITY; excess+=ret-GH_TERMINAL_VELOCITY; travelTime-=2; } return ret; } item script potion{ void run(int which){ G[G_HPDRAIN] = 0; G[G_HPDRAINPENALTY] = 0; if(which == 29) Game->DCounter[CR_LIFE]+=Link->MaxHP/2; else Game->DCounter[CR_LIFE]+=24; for(int i = G_LINK_EQUIPA; i<= G_LINK_EQUIPR; i++){ if(G[i] == 29 || G[i] == 30) G[i] = 0; } } } item script HPPickup{ void run(){ G[G_HPDRAIN] = 0; G[G_HPDRAINPENALTY] = 0; } } ffc script CurseCloud{ void run(int dir, int thickness){ int BubbleX[500]; int BubbleY[500]; int BubbleTile[500]; int BubbleVx[500]; int BubbleVy[500]; int counter = 0; if(Screen->State[ST_SECRET]) Quit(); while(true){ if(!Screen->State[ST_SECRET]){ for(int i = 0; iX; BubbleY[counter] = this->Y; BubbleTile[counter] = 511; if(Rand(0, 4) == 0) BubbleTile[counter] = 512; BubbleVx[counter] = Rand(-5, 5); if(dir == 1) BubbleVy[counter] = 4; counter++; if(counter == 499) counter = 0; } } for(int i = 0; i <500; i++){ if(BubbleTile[i] > 0){ if(Offscreen(BubbleX[i], BubbleY[i])){ BubbleTile[i] = 0; BubbleVx[i] = 0; BubbleVy[i] = 0; } else{ Screen->FastTile(5, BubbleX[i], BubbleY[i], BubbleTile[i], 0, OP_OPAQUE); if(G[G_GLOBALFRAMES] % 5 == 0){ if(BubbleVx[i] > 0) BubbleVx[i]--; if(BubbleVx[i] < 0) BubbleVx[i]++; if(BubbleVy[i] > -5) BubbleVy[i]--; if(BubbleVy[i] == 0) BubbleVy[i] = -1; } BubbleX[i] += BubbleVx[i]; BubbleY[i] += BubbleVy[i]; } } } Waitframe(); } } } bool Offscreen(int x, int y){ if(x<0) return true; else if(x>252) return true; else if(y<0) return true; else if(y>172) return true; else return false; } int GetAreaID(int dmap){ if(dmap == 0 || dmap == 28) //Hyrule return 0; if(dmap == 1) //Monument Cavern return 1; if(dmap == 2) //Suspended Reef return 2; if(dmap == 3) //Ship Graveyard return 3; if(dmap == 4) //Volcano return 4; if(dmap == 9) //Town return 5; if(dmap == 15 || dmap == 19) //Ocean return 6; if(dmap == 16) //Pacific Cliffs return 7; if(dmap == 17) //Jungle return 8; if(dmap == 18) //Tierra del Fuego return 9; if(dmap == 5) //Level 1 return 10; if(dmap == 6) //Level 2 return 11; if(dmap == 7 || dmap == 8) //Level 3 return 12; if(dmap == 10) //Level 4 return 13; if(dmap == 11) //Level 5 return 14; if(dmap == 22 || dmap == 23) //Level 6 return 15; if(dmap == 26 || dmap == 27) //Level 7 return 16; if(dmap >=29 && dmap <=36 ) //Level 8 return 17; if(dmap == 39 || dmap == 40) //Level 9 return 18; else return -1; } int GetAreaItemTotal(int area){ if(area == 0){ //Hyrule if(G[G_RANDO] == 1){ if(G[G_TABLETRANDO] == 1 && G[G_LYNELRANDO] == 1) return 27; else if(G[G_TABLETRANDO] == 1) return 25; else if(G[G_LYNELRANDO] == 1) return 24; else return 22; } else return 19; } if(area == 1) //Monument Cavern return 0; if(area == 2) //Suspended Reef return 2; if(area == 3) //Ship Graveyard return 3; if(area == 4){ //Volcano if(G[G_RANDO] == 1){ if(G[G_TABLETRANDO] == 1 && G[G_LYNELRANDO] == 1) return 8; else if(G[G_TABLETRANDO] == 1) return 6; else if(G[G_LYNELRANDO] == 1) return 7; else return 5; } else return 4; } if(area == 5) //Town return 7; if(area == 6) //Ocean return 4; if(area == 7){ //Pacific Cliffs if(G[G_RANDO] == 1){ if(G[G_TABLETRANDO] == 1 && G[G_LYNELRANDO] == 1) return 4; else if(G[G_TABLETRANDO] == 1) return 3; else if(G[G_LYNELRANDO] == 1) return 3; else return 2; } else return 2; } if(area == 8) //Jungle return 2; if(area == 9){ //Tierra del Fuego if(G[G_RANDO] == 1 && G[G_TABLETRANDO] == 1) return 3; else return 2; } if(area == 10){ //Level 1 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 5; else return 3; } if(area == 11){ //Level 2 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 6; else return 4; } if(area == 12){ //Level 3 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 6; else return 4; } if(area == 13){ //Level 4 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 5; else return 3; } if(area == 14){ //Level 5 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 5; else return 3; } if(area == 15){ //Level 6 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 6; else return 4; } if(area == 16){ //Level 7 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 6; else return 4; } if(area == 17){ //Level 8 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 6; else return 3; } if(area == 18){ //Level 9 if(G[G_RANDO] == 1 && G[G_JUNKRANDO] == 1) return 2; else return 0; } else return -1; } ffc script Boss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); // Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); // Ghost_SetFlag(GHF_8WAY); int vars[] = {Ghost_HP}; int counter = -1; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); while(true){ } } void Boss_Waitframe(ffc this, npc ghost, int vars){ if(!Ghost_Waitframe(this, ghost, false, false)){ Ghost_Explode(this, ghost); int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); Quit(); } } void Boss_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iCollDetection = false; int Timers[176]; int RockEmerge[20]; int RockX[20]; int RockY[20]; int V_SIDE = 1; int V_COUNTER = 5; int V_SUPERGOING = 6; int V_SUPERDONE = 7; int STOPROCK = 8; int vars[] = {Timers, 0, RockEmerge, RockX, RockY, 0, 0, 0, 0}; int Attack; int LastAttack = -1; int MaxHP = Ghost_HP; bool Super; int numattempts; bool ThisIsntHowADoWhileLoopIsSupposedToWork; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); Leever_Waitframes(this, ghost, vars, 60); while(true){ do Attack = Rand(0,2); while(Attack == LastAttack); LastAttack = Attack; if(Attack == 0){ for(int i = 0; i<=2; i++){ numattempts = 0; do{ ThisIsntHowADoWhileLoopIsSupposedToWork = false; Ghost_X = GridX(Rand(32, 208)); Ghost_Y = GridY(Rand(32, 128)); int Combo = ComboAt(Ghost_X, Ghost_Y); if(numattempts < 100){ for(int j = 0; j<5; j++){ if(Timers[Combo-34+j] > 0 || Timers[Combo-18+j] > 0 || Timers[Combo-2+j] > 0 || Timers[Combo+14+j] > 0 || Timers[Combo+28+j] > 0) ThisIsntHowADoWhileLoopIsSupposedToWork = true; } } else if(numattempts < 200){ for(int j = 0; j<3; j++){ if(Timers[Combo-17+j] > 0 || Timers[Combo-2+j] > 0 || Timers[Combo+15+j] > 0) ThisIsntHowADoWhileLoopIsSupposedToWork = true; } } numattempts++; } while(Distance(Link->X, Link->Y, GridX(Ghost_X), GridY(Ghost_Y)) < 24 || OnSolid(Ghost_X, Ghost_Y) || OnWater(Ghost_X, Ghost_Y) || ThisIsntHowADoWhileLoopIsSupposedToWork); Emerge(this, ghost, vars, 10); Leever_Waitframes(this, ghost, vars, 20); Create3x3Pit(ComboAt(Ghost_X, Ghost_Y), 1200, vars); Leever_Waitframes(this, ghost, vars, 60); Submerge(this, ghost, vars); } } // if(Attack == 1){ // Ghost_X = Link->X; // Ghost_Y = Link->Y; // Emerge(this, ghost, vars, 30); // Leever_Waitframes(this, ghost, vars, 30); // Submerge(this, ghost, vars); // } if(Attack == 1){ for(int i = 0; i<=1; i++){ do{ Ghost_X = GridX(Rand(32, 208)); Ghost_Y = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Ghost_X), GridY(Ghost_Y)) < 40 || OnSolid(Ghost_X, Ghost_Y) || OnWater(Ghost_X, Ghost_Y)); Emerge(this, ghost, vars, 10); Leever_Waitframes(this, ghost, vars, 20); for(int i = -60; i<=60; i+=30){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(i), 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); Leever_Waitframes(this, ghost, vars, 5); } Leever_Waitframes(this, ghost, vars, 60); if(i == 1) Leever_Waitframes(this, ghost, vars, 60); Submerge(this, ghost, vars); } } if(Attack == 2){ for(int i = 0; i<=1; i++){ do{ Ghost_X = GridX(Rand(32, 208)); Ghost_Y = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Ghost_X), GridY(Ghost_Y)) < 40 || Distance(Link->X, Link->Y, GridX(Ghost_X), GridY(Ghost_Y)) > 80 || OnSolid(Ghost_X, Ghost_Y) || OnWater(Ghost_X, Ghost_Y)); int Angle = Angle(Ghost_X, Ghost_Y, Link->X, Link->Y); Emerge(this, ghost, vars, 5); for(int i = 0; i<60&&Ghost_CanMove(AngleDir4(Angle), 2, 0); i++){ Ghost_MoveAtAngle(Angle, 2, 0); Leever_Waitframe(this, ghost, vars); } if(i==1) Leever_Waitframes(this, ghost, vars, 60); Submerge(this, ghost, vars); } } Leever_Waitframes(this, ghost, vars, 60); if(Ghost_HP <= MaxHP*0.5 && !Super){ Super = true; int CurHP = Ghost_HP; for(int i = 0; i<176; i++){ if(Timers[i]>0){ Destroy3x3Pit(i, vars[V_SUPERDONE]); Timers[i] = 0; } } vars[V_SIDE] = Rand(DIR_LEFT,DIR_RIGHT); if(vars[V_SIDE] == DIR_RIGHT){ for(int i = 32; i<= 208; i+=16){ for(int j = 32; j<=128; j+=16) Screen->ComboD[ComboAt(i,j)] = 4020; Leever_Waitframes(this, ghost, vars, 5); } } else{ for(int i = 208; i>= 32; i-=16){ for(int j = 32; j<=128; j+=16) Screen->ComboD[ComboAt(i,j)] = 4022; Leever_Waitframes(this, ghost, vars, 5); } } vars[V_SUPERGOING] = 1; while(CurHP <= Ghost_HP + 200){ do{ Ghost_X = GridX(Rand(32, 208)); Ghost_Y = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Ghost_X), GridY(Ghost_Y)) < 40 || OnSolid(Ghost_X, Ghost_Y) || OnWater(Ghost_X, Ghost_Y)); Emerge(this, ghost, vars, 10); Leever_Waitframes(this, ghost, vars, 20); // for(int i = -60; i<=60; i+=30){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); Leever_Waitframes(this, ghost, vars, 5); // } Leever_Waitframes(this, ghost, vars, 120); Submerge(this, ghost, vars); Leever_Waitframes(this, ghost, vars, 30); } Submerge(this, ghost, vars); vars[STOPROCK] = 1; for(int i = 0; i<20; i++) RockEmerge[i] = 20; if(vars[V_SIDE] == DIR_LEFT){ for(int i = 32; i<= 208; i+=16){ for(int j = 32; j<=128; j+=16) Screen->ComboD[ComboAt(i,j)] = 5131; Leever_Waitframes(this, ghost, vars, 5); } } else{ for(int i = 208; i>= 32; i-=16){ for(int j = 32; j<=128; j+=16) Screen->ComboD[ComboAt(i,j)] = 5131; Leever_Waitframes(this, ghost, vars, 5); } } Leever_Waitframes(this, ghost, vars, 30); for(int i = 48; i<= 192; i+=16){ Screen->ComboD[ComboAt(i,32)] = 4017; Screen->ComboD[ComboAt(i,128)] = 4025; } for(int i = 48; i<= 112; i+=16){ Screen->ComboD[ComboAt(32,i)] = 4020; Screen->ComboD[ComboAt(208,i)] = 4022; } Screen->ComboD[ComboAt(32,32)] = 4016; Screen->ComboD[ComboAt(208,32)] = 4018; Screen->ComboD[ComboAt(32,128)] = 4024; Screen->ComboD[ComboAt(208,128)] = 4026; vars[V_SUPERGOING] = 0; vars[V_SUPERDONE] = 1; } } } bool isWall(int combo, int T2){ if(T2 == 0){ if(ComboX(combo) <=16 || ComboX(combo) >=224) return true; if(ComboY(combo) <=16 || ComboY(combo) >=144) return true; return false; } else{ if(ComboX(combo) <=32 || ComboX(combo) >=208) return true; if(ComboY(combo) <=32 || ComboY(combo) >=128) return true; return false; } } void Create3x3Pit(int combo, int time, int vars){ int T2 = vars[7]; for(int i = 0; i<=2; i++){ if(!isWall(combo - 17 + i, T2)) Screen->ComboD[combo-17+i] = 4016+i; if(!isWall(combo +15 + i, T2)) Screen->ComboD[combo+15+i] = 4024+i; if(!isWall(combo-1+i, T2)) Screen->ComboD[combo-1+i] = 4020+i; } int Timers = vars[0]; Timers[combo] = time; } void Destroy3x3Pit(int combo, int T2){ for(int i = 0; i<=2; i++){ if(!isWall(combo - 17 + i, T2)) Screen->ComboD[combo-17+i] = 5131; if(!isWall(combo +15 + i, T2)) Screen->ComboD[combo+15+i] = 5131; if(!isWall(combo-1+i, T2)) Screen->ComboD[combo-1+i] = 5131; } } void Emerge(ffc this, npc ghost, int vars, int speed){ Ghost_Data = 5660; Leever_Waitframes(this, ghost, vars, speed); Ghost_Data = 5661; ghost->CollDetection = true; Leever_Waitframes(this, ghost, vars, 10); Ghost_Data = 5662; } void Submerge(ffc this, npc ghost, int vars){ Ghost_Data = 5661; Leever_Waitframes(this, ghost, vars, 10); Ghost_Data = 5660; ghost->CollDetection = false; Leever_Waitframes(this, ghost, vars, 10); Ghost_Data = 1; } void Leever_Waitframe(ffc this, npc ghost, int vars){ int Timer = vars[0]; int RockEmerge = vars[2]; int RockX = vars[3]; int RockY = vars[4]; int V_SIDE = 1; int V_COUNTER = 5; int V_SUPERGOING = 6; int V_SUPERDONE = 7; for(int i = 0; i<176; i++){ if(Timer[i]>0){ Timer[i]--; if(Timer[i] == 0) Destroy3x3Pit(i, vars[V_SUPERDONE]); } } if(vars[V_SUPERGOING] == 1){ for(int i = 0; i<20; i++){ if(RockEmerge[i] == 20 && RockX[i] != -1){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, RockX[i], RockY[i]); l->UseSprite(140); l->DeadState = l->NumFrames*l->ASpeed; Game->PlaySound(71); RockEmerge[i] = 0; } else if(RockEmerge[i] == 17){ if(vars[V_SIDE] == DIR_RIGHT) RockX[i]+=2; else RockX[i]-=2; if(RectCollision(Link->X+2, Link->Y+2, Link->X+14, Link->Y+14, RockX[i]+4, RockY[i]+4, RockX[i]+12, RockY[i]+12)){ DamageLink(ghost->WeaponDamage); lweapon l = CreateLWeaponAt(LW_SCRIPT10, RockX[i], RockY[i]); l->UseSprite(140); l->DeadState = l->NumFrames*l->ASpeed; Game->PlaySound(71); RockEmerge[i] = 0; RockX[i] = -16; } if(RockX[i] <= 24 || RockX[i] >= 216){ lweapon l = CreateLWeaponAt(LW_SCRIPT10, RockX[i], RockY[i]); l->UseSprite(140); l->DeadState = l->NumFrames*l->ASpeed; Game->PlaySound(71); RockEmerge[i] = 0; RockX[i] = -16; } Screen->FastTile(2, RockX[i], RockY[i], 14735, 4, OP_OPAQUE); } else if(RockEmerge[i] > 0){ Screen->FastTile(2, RockX[i], RockY[i], 14720 + RockEmerge[i] - 1, 4, OP_OPAQUE); RockEmerge[i]++; } } if(G[G_GLOBALFRAMES] % 120 == 0 && vars[8] == 0){ for(int i = 0; i<3; i++){ int yspot = GridY(Rand(32, 128)); if(vars[V_SIDE] == DIR_RIGHT) RockX[vars[V_COUNTER]] = 32; else RockX[vars[V_COUNTER]] = 208; RockY[vars[V_COUNTER]] = yspot; RockEmerge[vars[V_COUNTER]] = 1; vars[V_COUNTER]++; if(vars[V_COUNTER] == 20) vars[V_COUNTER] = 0; } } } if(!Ghost_Waitframe(this, ghost, false, false)){ Ghost_Explode(this, ghost); for(int i = 0; i<176; i++){ if(!isWall(i, 0)) Screen->ComboD[i] = 5131; } int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); Quit(); } } void Leever_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iComboT[ComboAt(TeleX, TeleY)] == CT_WATER) return true; if(Screen->ComboT[ComboAt(TeleX+15, TeleY)] == CT_WATER) return true; if(Screen->ComboT[ComboAt(TeleX, TeleY+15)] == CT_WATER) return true; if(Screen->ComboT[ComboAt(TeleX+15, TeleY+15)] == CT_WATER) return true; else return false; } bool OnSolid(int TeleX, int TeleY){ if(Screen->isSolid(TeleX, TeleY)) return true; if(Screen->isSolid(TeleX+15, TeleY)) return true; if(Screen->isSolid(TeleX, TeleY+15)) return true; if(Screen->isSolid(TeleX+15, TeleY+15)) return true; else return false; } ffc script ArmosBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); // Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_4WAY); Ghost_Data = 5664; Ghost_CSet = 11; int SpearX[15]; int SpearY[15]; int SpearZ[15]; int SpearTimer[15]; int UpSpearX[3]; int UpSpearY[3]; int UpSpearZ[3]; int V_PHASE = 0; int V_HITS = 1; int V_SUMMON = 9; int V_TIMER1 = 10; int V_TIMER2 = 11; int vars[] = {0, 0, SpearX, SpearY, SpearZ, SpearTimer, UpSpearX, UpSpearY, UpSpearZ, 0, 0, 0, 0, 0, 0, 0, 0, 8}; int Attack = 0; int SpearCounter = 0; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); while(true){ for(int i = Rand(120, 240); i>0; i--){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); if(vars[V_PHASE] == 0) Ghost_MoveTowardLink(0.7, 8); else Ghost_MoveTowardLink(0.9, 8); Armos_Waitframe(this, ghost, vars); } if(Rand(0,1) == 0) Attack = 2; else Attack = Rand(0, 1); if(Attack == 0){ Armos_Waitframes(this, ghost, vars, 30); Ghost_Data+=4; for(int i = 0; i<3; i++){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 350, ghost->WeaponDamage, 142, 1, EWF_UNBLOCKABLE|EWF_ROTATE_360); SetEWeaponLifespan(e, EWL_NEAR_LINK, 8); SetEWeaponDeathEffect(e, EWD_SBOMB_EXPLODE, ghost->WeaponDamage); if(i == 1) SetEWeaponMovement(e, EWM_HOMING_REAIM, 1, 30); Armos_Waitframes(this, ghost, vars, 30); } Ghost_Data-=4; Armos_Waitframes(this, ghost, vars, 90); } if(Attack == 2){ Ghost_Dir = DIR_UP; Ghost_Data+=4; Armos_Waitframes(this, ghost, vars, 30); for(int i = 0; i<3; i++){ UpSpearX[i] = Ghost_X; UpSpearY[i] = Ghost_Y; UpSpearZ[i] = 1; Game->PlaySound(1); Armos_Waitframes(this, ghost, vars, 5); } Ghost_Data-=4; Armos_Waitframes(this, ghost, vars, 30); for(int i = 0; i<3; i++){ SpearX[SpearCounter] = GridX(Rand(32, 208)); SpearY[SpearCounter] = GridY(Rand(32, 128)); SpearZ[SpearCounter] = 100; SpearTimer[SpearCounter] = Rand(180, 1000); SpearCounter++; if(SpearCounter == 15) SpearCounter = 0; } } if(Attack == 1){ int Angle = Angle(Ghost_X, Ghost_Y, Link->X, Link->Y); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Armos_Waitframes(this, ghost, vars, 30); for(int i = 0; i<30&&Ghost_CanMove(AngleDir4(Angle), 2, 0); i++){ Ghost_MoveAtAngle(Angle, 2, 0); Armos_Waitframe(this, ghost, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data+=4; eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 450, ghost->WeaponDamage, 142, 1, EWF_UNBLOCKABLE|EWF_ROTATE_360); SetEWeaponLifespan(e, EWL_NEAR_LINK, 8); SetEWeaponDeathEffect(e, EWD_SBOMB_EXPLODE, ghost->WeaponDamage); Armos_Waitframes(this, ghost, vars, 60); Ghost_Data-=4; Armos_Waitframes(this, ghost, vars, 90); } if(CountFFCsRunning(11) < 1 && vars[10] == 0 && (Rand(0,2) == 0 || vars[0] == 1)){ vars[V_SUMMON] = 1; } } } void Armos_Waitframe(ffc this, npc ghost, int vars){ int SpearX = vars[2]; int SpearY = vars[3]; int SpearZ = vars[4]; int SpearTimer = vars[5]; int UpSpearX = vars[6]; int UpSpearY = vars[7]; int UpSpearZ = vars[8]; for(int i = 0; i<3; i++){ if(UpSpearZ[i] > 0 && UpSpearZ[i] < 150){ UpSpearZ[i] += 3; Screen->FastTile(6, UpSpearX[i], UpSpearY[i]-UpSpearZ[i], 62931, 11, OP_OPAQUE); Screen->FastTile(1, UpSpearX[i], UpSpearY[i], 27401, 7, OP_OPAQUE); } } for(int i = 0; i<15; i++){ if(SpearX[i] > 0){ if(SpearZ[i] > 0){ Screen->FastTile(6, SpearX[i], SpearY[i]-SpearZ[i], 62930, 11, OP_OPAQUE); SpearZ[i]-=2; Screen->FastTile(1, SpearX[i], SpearY[i], 27401, 7, OP_OPAQUE); } else if(SpearTimer[i] > 90 || G[G_GLOBALFRAMES]%2==0) Screen->FastTile(6, SpearX[i], SpearY[i]-SpearZ[i], 62932, 11, OP_OPAQUE); else Screen->FastTile(6, SpearX[i], SpearY[i]-SpearZ[i], 62933, 8, OP_OPAQUE); if(SpearTimer[i] > 0) SpearTimer[i]--; if((SpearTimer[i] == 0 || Distance(Link->X, Link->Y, SpearX[i], SpearY[i]) < 16) && SpearZ[i] == 0){ FireEWeapon(EW_SBOMBBLAST, SpearX[i], SpearY[i], 0, 0, ghost->WeaponDamage, -1, -1, 0); SpearX[i] = 0; } } } if(vars[16] <= 0){ for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_BOMBBLAST || e->ID == EW_SBOMBBLAST){ if(Collision(ghost, e)){ vars[1]++; Ghost_HP -= 400; Game->PlaySound(15); vars[16] = 45; if(vars[1] >= 3 && vars[0] == 0){ vars[0] = 1; Ghost_Data += 8; Ghost_CSet = 8; int SpecialDefenses[18] = {NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_IGNORE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE}; Ghost_SetDefenses(ghost, SpecialDefenses); vars[17] = 11; for(int i = 1; i<=32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 11){ FireEWeapon(EW_BOMBBLAST, f->X, f->Y, 0, 0, ghost->WeaponDamage, -1, -1, 0); Screen->ComboD[ComboAt(f->X, f->Y)] = 516; f->Script = 0; f->Data = 0; } } } } } } } else vars[16]--; if(vars[9] == 1){ vars[9] = 0; vars[10] = 1; for(int i = 0; i<2; i++){ bool retry; do{ retry = false; vars[12+i*2] = GridX(Rand(48, 192)); vars[13+i*2] = GridX(Rand(48, 112)); for(int i = 1; i<=32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 11){ if(Distance(f->X, f->Y, vars[12+i*2], vars[13+i*2]) <= 32) retry = true; } } if(i == 1){ if(vars[12] == vars[14] && vars[13] == vars[15]) retry = true; } } while(retry); } Game->PlaySound(63); } if(vars[10] == 1){ for(int i = 0; i<2; i++){ int FloorCombo = Screen->ComboD[ComboAt(vars[12+i*2], vars[13+i*2])]; int FloorTile = Game->ComboTile(FloorCombo); int FloorCSet = Screen->ComboC[ComboAt(vars[12+i*2], vars[13+i*2])]; int FloorCombo2 = Screen->ComboD[ComboAt(vars[12+i*2]-16, vars[13+i*2])]; int FloorTile2 = Game->ComboTile(FloorCombo2); int FloorCSet2 = Screen->ComboC[ComboAt(vars[12+i*2]-16, vars[13+i*2])]; Screen->FastTile(0, vars[12+i*2], vars[13+i*2], 20, FloorCSet, OP_OPAQUE); Screen->FastTile(0, vars[12+i*2], vars[13+i*2], 63000, vars[17], OP_OPAQUE); Screen->FastTile(0, vars[12+i*2]-vars[11], vars[13+i*2], FloorTile, FloorCSet, OP_OPAQUE); Screen->FastTile(0, vars[12+i*2]-16, vars[13+i*2], FloorTile2, FloorCSet2, OP_OPAQUE); } vars[11]++; if(vars[11] == 17){ vars[11] = 0; vars[10] = 2; } } if(vars[10] == 2){ for(int i = 0; i<2; i++){ Screen->FastTile(0, vars[12+i*2], vars[13+i*2], 20, 0, OP_OPAQUE); Screen->FastTile(1, vars[12+i*2], vars[13+i*2], 63000+vars[11], vars[17], OP_OPAQUE); } vars[11]++; if(vars[11] == 9){ vars[11] = 16; vars[10] = 3; Game->PlaySound(63); } } if(vars[10] == 3){ for(int i = 0; i<2; i++){ int FloorCombo = Screen->ComboD[ComboAt(vars[12+i*2], vars[13+i*2])]; int FloorTile = Game->ComboTile(FloorCombo); int FloorCSet = Screen->ComboC[ComboAt(vars[12+i*2], vars[13+i*2])]; int FloorCombo2 = Screen->ComboD[ComboAt(vars[12+i*2]-16, vars[13+i*2])]; int FloorTile2 = Game->ComboTile(FloorCombo2); int FloorCSet2 = Screen->ComboC[ComboAt(vars[12+i*2]-16, vars[13+i*2])]; Screen->FastTile(0, vars[12+i*2], vars[13+i*2], 20, FloorCSet, OP_OPAQUE); Screen->FastTile(0, vars[12+i*2]-vars[11], vars[13+i*2], FloorTile, FloorCSet, OP_OPAQUE); Screen->FastTile(0, vars[12+i*2]-16, vars[13+i*2], FloorTile2, FloorCSet2, OP_OPAQUE); Screen->FastTile(0, vars[12+i*2], vars[13+i*2], 63007, vars[17], OP_OPAQUE); } vars[11]--; if(vars[11] == 0){ vars[11] = 0; vars[10] = 0; for(int i = 0; i<2; i++){ ffc f = FindFreeFFC(); f->X = vars[12+i*2]; f->Y = vars[13+i*2]; f->Data = 4084; f->CSet = vars[17]; f->Script = 11; f->InitD[0] = 62; if(vars[0] == 1) f->InitD[1] = 1; else f->InitD[1] = 2; f->InitD[2] = 4083; } } } if(!Ghost_Waitframe(this, ghost, false, false)){ Ghost_Explode(this, ghost); for(int i = 1; i<=32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 11){ FireEWeapon(EW_BOMBBLAST, f->X, f->Y, 0, 0, 2, -1, -1, 0); Screen->ComboD[ComboAt(f->X, f->Y)] = 516; f->Script = 0; f->Data = 0; } } int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 13); Quit(); } } void Armos_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iPlayEnhancedMusic(Music, 0); Fish_Waitframes(this, ghost, vars, 60); vars[8] = 1; int attacktimer=0; while(true){ if(vars[15] == 0){ if(vars[V_FORMATION] == DIR_LEFT){ int GoalX = Link->X + 96; if(Ghost_X < GoalX-2 && Ghost_X < 240) Ghost_X++; if(Ghost_X > GoalX+2) Ghost_X--; } if(Ghost_Dir == DIR_UP && G[G_GLOBALFRAMES] % 2 == 0) Ghost_Y--; if(Ghost_Dir == DIR_DOWN && G[G_GLOBALFRAMES] % 2 == 0) Ghost_Y++; if(G[G_GLOBALFRAMES] % 60 == 0 && Rand(0, 2) == 0){ if(Ghost_Dir == DIR_UP) Ghost_Dir = DIR_DOWN; else Ghost_Dir = DIR_UP; } if(Ghost_Y <=32) Ghost_Dir = DIR_DOWN; if(Ghost_Y >=144) Ghost_Dir = DIR_UP; if(attacktimer<300) attacktimer++; // if(Rand(0, 360) == 0){ else{ attacktimer=0; Attack = Rand(0,1); if(Attack == 0){ Fish_Waitframes(this, ghost, vars, 30); int Angle = Angle(Ghost_X, Ghost_Y, Link->X, Link->Y); int Xpoint = Link->X; int Ypoint = Link->Y; Fish_Waitframes(this, ghost, vars, 15); while(LargeDistance(Ghost_X, Ghost_Y, Xpoint, Ypoint) >= 8){ if(vars[15] != 0) break; Ghost_MoveAtAngle(Angle, 1.5, 0); Fish_Waitframe(this, ghost, vars); } } if(Attack == 1){ bool breakflag; for(int i = 0; i<30; i++){ if((i+1)%5 == 0){ if(vars[V_ORBCOLOR] == 7) vars[V_ORBCOLOR] = 8; else vars[V_ORBCOLOR] = 7; } if(vars[15] != 0){ breakflag = true; break; } Fish_Waitframe(this, ghost, vars); } Game->PlaySound(77); int speed = 1.5; vars[19] = -1; // int Angle1 = Angle(SwarmCenterX[5],SwarmCenterY[5], Link->X+8, Link->Y+8); // int Angle2 = Angle(SwarmCenterX[10],SwarmCenterY[10], Link->X+8, Link->Y+8); int Angle1 = 180; int Angle2 = 180; for(int i = 0; i<120&&!breakflag; i++){ if((i+1)%30 == 0){ Angle1 = Angle(SwarmCenterX[5],SwarmCenterY[5], Link->X+8, Link->Y+8); Angle2 = Angle(SwarmCenterX[10],SwarmCenterY[10], Link->X+8, Link->Y+8); } SwarmCenterX[0] -= speed*0.7071; SwarmCenterY[0] -= speed*0.7071; SwarmCenterY[1] -= speed; SwarmCenterX[2] += speed*0.7071; SwarmCenterY[2] -= speed*0.7071; SwarmCenterX[3] -= speed; SwarmCenterX[4] -= speed; SwarmCenterX[8] -= speed; SwarmCenterX[9] -= speed; SwarmCenterX[6] += speed; SwarmCenterX[7] += speed; SwarmCenterX[11] += speed; SwarmCenterX[12] += speed; SwarmCenterX[13] += speed*0.7071; SwarmCenterY[13] -= speed*0.7071; SwarmCenterY[14] += speed; SwarmCenterX[15] += speed*0.7071; SwarmCenterY[15] += speed*0.7071; SwarmCenterX[5] += VectorX(2, Angle1); SwarmCenterY[5] += VectorY(2, Angle1); SwarmCenterX[10] += VectorX(2, Angle2); SwarmCenterY[10] += VectorY(2, Angle2); for(int j = 0; j<16; j++){ if(LargeDistance(Link->X+8, Link->Y+8, SwarmCenterX[j], SwarmCenterY[j]) <= 8) DamageLink(ghost->WeaponDamage); } if(vars[15] != 0){ breakflag = true; break; } Fish_Waitframe(this, ghost, vars); } vars[19] = 90; } } } Fish_Waitframe(this, ghost, vars); } } void Fish_Waitframe(ffc this, npc ghost, int vars){ if(Game->Counter[CR_RUPEES] == 0 && Screen->NumNPCs() == 1 && Screen->NumItems() == 0) QuickSpawn(178); int SwarmX = vars[0]; int SwarmY = vars[1]; int SwarmVx = vars[2]; int SwarmVy = vars[3]; int SwarmCombo = vars[4]; int SwarmCenterX = vars[5]; int SwarmCenterY = vars[6]; int Stalagmites = vars[10]; if(vars[15] == 0){ Screen->FastCombo(6, Ghost_X, Ghost_Y-2, 3939, vars[18], OP_OPAQUE); if(Ghost_HP < vars[16]){ Ghost_HP = vars[16]; vars[14]++; } if(vars[14] == 8){ vars[15] = 1; vars[14] = 0; } if(vars[17] > 0) vars[17]--; else if(vars[19] == 0){ if(RectCollision(Link->X+2, Link->Y+2, Link->X+14, Link->Y+14, Ghost_X-32, Ghost_Y-16, Ghost_X + 40, Ghost_Y+16)) //Main box DamageLink(ghost->Damage); if(RectCollision(Link->X+2, Link->Y+2, Link->X+14, Link->Y+14, Ghost_X-16, Ghost_Y-32, Ghost_X + 16, Ghost_Y+32)) //Vertical fins DamageLink(ghost->Damage); if(RectCollision(Link->X+2, Link->Y+2, Link->X+14, Link->Y+14, Ghost_X+32, Ghost_Y-32, Ghost_X + 48, Ghost_Y+32)) //Tail fins DamageLink(ghost->Damage); // Screen->Rectangle(6, Ghost_X-32, Ghost_Y-16, Ghost_X + 40, Ghost_Y+16, 1, -1, 0, 0, 0, false, OP_OPAQUE); // Screen->Rectangle(6, Ghost_X-16, Ghost_Y-32, Ghost_X + 16, Ghost_Y+32, 1, -1, 0, 0, 0, false, OP_OPAQUE); // Screen->Rectangle(6, Ghost_X+32, Ghost_Y-32, Ghost_X + 48, Ghost_Y+32, 1, -1, 0, 0, 0, false, OP_OPAQUE); } if(vars[19] > 0) vars[19]--; if(vars[7] == DIR_LEFT && vars[19] != -1){ //Top row SwarmCenterX[0] = -16 + Ghost_X; SwarmCenterY[0] = -24 + Ghost_Y; SwarmCenterX[1] = 0 + Ghost_X; SwarmCenterY[1] = -24 + Ghost_Y; SwarmCenterX[2] = 32 + Ghost_X; SwarmCenterY[2] = -24 + Ghost_Y; //2nd row SwarmCenterX[3] = -32 + Ghost_X; SwarmCenterY[3] = -8 + Ghost_Y; SwarmCenterX[4] = -16 + Ghost_X; SwarmCenterY[4] = -8 + Ghost_Y; SwarmCenterX[5] = 0 + Ghost_X; SwarmCenterY[5] = -8 + Ghost_Y; SwarmCenterX[6] = 16 + Ghost_X; SwarmCenterY[6] = -8 + Ghost_Y; SwarmCenterX[7] = 32 + Ghost_X; SwarmCenterY[7] = -8 + Ghost_Y; //3rd row SwarmCenterX[8] = -32 + Ghost_X; SwarmCenterY[8] = 8 + Ghost_Y; SwarmCenterX[9] = -16 + Ghost_X; SwarmCenterY[9] = 8 + Ghost_Y; SwarmCenterX[10] = 0 + Ghost_X; SwarmCenterY[10] = 8 + Ghost_Y; SwarmCenterX[11] = 16 + Ghost_X; SwarmCenterY[11] = 8 + Ghost_Y; SwarmCenterX[12] = 32 + Ghost_X; SwarmCenterY[12] = 8 + Ghost_Y; //Top row SwarmCenterX[13] = -16 + Ghost_X; SwarmCenterY[13] = 24 + Ghost_Y; SwarmCenterX[14] = 0 + Ghost_X; SwarmCenterY[14] = 24 + Ghost_Y; SwarmCenterX[15] = 32 + Ghost_X; SwarmCenterY[15] = 24 + Ghost_Y; } for(int i = 0; i<320; i++){ if(LargeDistance(SwarmX[i], SwarmY[i], SwarmCenterX[Floor(i/20)], SwarmCenterY[Floor(i/20)]) > 16){ int angle = Angle(SwarmX[i], SwarmY[i], SwarmCenterX[Floor(i/20)], SwarmCenterY[Floor(i/20)]); SwarmX[i] += VectorX(5, angle); SwarmY[i] += VectorY(5, angle); } else{ SwarmX[i] += SwarmVx[i]; SwarmY[i] += SwarmVy[i]; if(LargeDistance(SwarmX[i], SwarmY[i], SwarmCenterX[Floor(i/20)], SwarmCenterY[Floor(i/20)]) > 8){ int angle = Angle(SwarmCenterX[Floor(i/20)], SwarmCenterY[Floor(i/20)], SwarmX[i], SwarmY[i]); if(angle < 0 && angle >= -90){ //Quadrant 1 SwarmVx[i] = -1 * Abs(SwarmVx[i]); SwarmVy[i] = Abs(SwarmVy[i]); } if((angle <= -90 && angle >= -180) || angle == 180){ //Quadrant 2 SwarmVx[i] = Abs(SwarmVx[i]); SwarmVy[i] = Abs(SwarmVy[i]); } if(angle >= 0 && angle < 90){ //Quadrant 4 SwarmVx[i] = -1 * Abs(SwarmVx[i]); SwarmVy[i] = -1 * Abs(SwarmVy[i]); } if(angle >= 90 && angle < 180){ //Quadrant 3 SwarmVx[i] = Abs(SwarmVx[i]); SwarmVy[i] = -1 * Abs(SwarmVy[i]); } } } int flip; if(SwarmVx[i] > 0) flip = 1; Screen->DrawCombo(5, SwarmX[i], SwarmY[i], SwarmCombo[i], 1, 1, 0, -1, -1, 0, 0, 0, 0, flip, true, OP_OPAQUE); } if(vars[8] == 1){ //Good to go if(G[G_GLOBALFRAMES] % 90 == 0 && vars[19] == 0){ eweapon fish = FireAimedEWeapon(EW_SCRIPT1, Ghost_X + Rand(-32, 32), Ghost_Y + Rand(-32, 32), 0, 150, ghost->WeaponDamage, 143, 40, EWF_UNBLOCKABLE|EWF_ROTATE_360); } } } else{ if(vars[14] == 0){ Ghost_CSet = 8; Game->PlaySound(77); for(int i = 0; i<320; i++){ SwarmVx[i] = Choose(1,-1) * Rand(1,4); SwarmVy[i] = Choose(1,-1) * Rand(1,4); } } if(vars[14] < 180){ for(int i = 0; i<320; i++){ SwarmX[i] += SwarmVx[i]; SwarmY[i] += SwarmVy[i]; int flip; if(SwarmVx[i] > 0) flip = 1; Screen->DrawCombo(5, SwarmX[i], SwarmY[i], SwarmCombo[i], 1, 1, 0, -1, -1, 0, 0, 0, 0, flip, true, OP_OPAQUE); } } vars[14]++; if(Ghost_HP <= vars[16] - 1000 && Ghost_HP >0){ vars[14] = 0; vars[15] = 0; vars[16] = Ghost_HP; vars[17] = 120; vars[19] = 90; Ghost_CSet = 7; } } int i; if(vars[9] ==0 && vars[15] == 0){ vars[11] = ComboAt(Link->X-32, Link->Y-24); for(int b = 0; b <12; b++){ Stalagmites[b] = -1; } for(i = 0; i < 12; i++){ Stalagmites[i] = Rand(0, 24); for(int a = 0; a < i; a++){ while(Stalagmites[a] == Stalagmites[i]) Stalagmites[i] = Rand(0, 24); } } } if(vars[9] >1 && vars[9] <60){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63352, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] == 60) Game->PlaySound(30); if(vars[9] >= 60 && vars[9] < 66){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63353, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >= 66 && vars[9] <72){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63354, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >=72 && vars[9] <78){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63355, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9]>=78 && vars[9] < 120){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63356, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >=120 && vars[9] <126){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63355, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >= 126 && vars[9] <132){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63354, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >= 132 && vars[9] < 138){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63353, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >=138 && vars[9] <144){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144) Screen->DrawTile(1, vars[12], vars[13], 63352, 1, 1, 8, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); } } } if(vars[9] >= 72 && vars[9] <126){ for(i = 0; i < 12; i++){ if(Screen->NumNPCs() == 1 || i > 2){ vars[12] = ComboX(vars[11]) + Stalagmites[i]%5*16; vars[13] = ComboY(vars[11]) + Floor(Stalagmites[i]/5)*16; if(vars[12] >=28 && vars[12] < 224 && vars[13] >= 48 && vars[13] < 144){ eweapon spike = FireEWeapon(EW_SCRIPT1, vars[12], vars[13], 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(spike, EWL_TIMER, 2); SetEWeaponDeathEffect(spike, EWD_VANISH, 0); spike->HitWidth = 10; spike->HitHeight = 12; spike->HitXOffset = 3; spike->HitYOffset = 2; } } } } vars[9]++; if(vars[15] == 1) vars[9] = 0; if(G[G_DIFFICULTY] >= DIF_HARD){ if(vars[9] == 300) //264? vars[9] = 0; } else{ if(vars[9] == 400) //264? vars[9] = 0; } if(!Ghost_Waitframe(this, ghost, false, false)){ // Screen->FastCombo(6, Ghost_X, Ghost_Y, 3939, 7, OP_OPAQUE); // for(int i = 0; i<320; i++){ // SwarmVx[i] = Choose(1,-1) * Rand(1,6); // SwarmVy[i] = Choose(1,-1) * Rand(1,6); // } // __DeathAnimStart(this, ghost); // __DeathAnimSFX(ghost->ID, ghost->X); // for(int j = 0; j<180; j++){ // for(int i = 0; i<320; i++){ // SwarmX[i] += SwarmVx[i]; // SwarmY[i] += SwarmVy[i]; // int flip; // if(SwarmVx[i] > 0) // flip = 1; // Screen->DrawCombo(5, SwarmX[i], SwarmY[i], SwarmCombo[i], 1, 1, 0, -1, -1, 0, 0, 0, 0, flip, true, OP_OPAQUE); // } // Ghost_WaitframeLight(this, ghost); // } Ghost_Explode(this, ghost); // __DeathAnimEnd(this, ghost); if(Screen->NumNPCs() > 0){ for(int i = Screen->NumNPCs(); i>0; i--){ npc n = Screen->LoadNPC(i); n->HP = 0; } } int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); Quit(); } } void Fish_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iX, m->Y); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; return m; } ffc script CurseBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); // Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); // Ghost_SetFlag(GHF_8WAY); Ghost_Transform(this, ghost, 5680, 10, 2, 2); int SpireShockX[20]; int SpireShockY[20]; int SpireX[20]; int SpireY[20]; int SpireTimer[20]; int BubbleX[50]; int BubbleY[50]; int BubbleStep[50]; int BubblePattern[50]; int BubbleTile[50]; int V_PHASE = 6; int V_NUMROCKS = 7; int V_ROCKTIMER = 8; int V_BOMBHITS = 9; int vars[] = {SpireShockX, SpireShockY, SpireX, SpireY, SpireTimer, 0, 0, 0, 0, 0, BubbleX, BubbleY, BubbleStep, BubblePattern, 0, BubbleTile}; int WalkSpeed = 1.5; int Attack; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); Curse_Waitframes(this, ghost, vars, 60); while(true){ if(vars[V_PHASE] == 1) WalkSpeed = 2.5; for(int i = Rand(1, 3); i>0; i--){ int TargetX = Link->X; int TargetY = Link->Y; Game->PlaySound(61); Ghost_Data++; int timer; while(Distance(Ghost_X+16, Ghost_Y+16, TargetX, TargetY) > 8 ){ int Angle = Angle(Ghost_X+16, Ghost_Y+16, TargetX, TargetY); Ghost_MoveAtAngle(Angle, WalkSpeed, 0); if(Sin(Angle) >=0 && !Ghost_CanMove(DIR_UP, VectorY(WalkSpeed, Angle),0)) break; if(Sin(Angle) <0 && !Ghost_CanMove(DIR_DOWN, VectorY(WalkSpeed, Angle),0)) break; if(Cos(Angle) >=0 && !Ghost_CanMove(DIR_RIGHT, VectorY(WalkSpeed, Angle),0)) break; if(Cos(Angle) <0 && !Ghost_CanMove(DIR_LEFT, VectorY(WalkSpeed, Angle),0)) break; timer++; if(timer > 90) break; Curse_Waitframe(this, ghost, vars); } Ghost_Data--; Curse_Waitframes(this, ghost, vars, 30); if(Rand(0,2) == 0 && CountSpires(vars) < 10){ for(int j = 0; j<3; j++){ ShockwaveSpire(Ghost_X+8, Ghost_Y+8, GridX(Rand(32, 208)), GridY(Rand(32, 128)), vars); } Curse_Waitframes(this, ghost, vars, 30); } } if(CountSpires(vars) > 10) Attack = Rand(2,4); else if(CountSpires(vars) > 5) Attack = Rand(1,4); else Attack = Rand(0,4); if(Attack == 0){ Curse_Waitframes(this, ghost, vars, 60); for(int i = 0; i<360-45; i+=45){ ShockwaveSpire(Ghost_X+8, Ghost_Y+8, Clamp(Ghost_X+16 + VectorX(48, i), 32, 208), Clamp(Ghost_Y+16 + VectorY(48, i), 32, 128), vars); } Curse_Waitframes(this, ghost, vars, 120); } if(Attack == 1){ Curse_Waitframes(this, ghost, vars, 15); for(int i = 0; i<3; i++){ ShockwaveSpire(Ghost_X+8, Ghost_Y+8, Clamp(GridX(Link->X+8+ RussInFrontX(Link->Dir, 48)), 32, 208), Clamp(GridY(Link->Y+8+ RussInFrontY(Link->Dir, 48)), 32, 128), vars); Curse_Waitframes(this, ghost, vars, 15); } } if(Attack == 2){ Curse_Waitframes(this, ghost, vars, 15); Ghost_Jump = 2; Ghost_Z = 1; while(Ghost_Z > 0) Curse_Waitframe(this, ghost, vars); vars[V_NUMROCKS] = 6; } if(Attack == 3){ for(int i = 0; i<30; i++){ if(i == 0 || i == 10 || i == 20) Ghost_Data+=4; if(i == 5 || i == 15 || i == 25) Ghost_Data-=4; Curse_Waitframe(this, ghost, vars); } for(int i = -60; i<=60; i+=30){ eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, DegtoRad(i), 300, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); // e->CollDetection = false; Curse_Waitframes(this, ghost, vars, 5); } } if(Attack == 4){ for(int i = 0; i<30; i++){ if(i == 0 || i == 10 || i == 20) Ghost_Data+=4; if(i == 5 || i == 15 || i == 25) Ghost_Data-=4; Curse_Waitframe(this, ghost, vars); } for(int i = 0; i<3; i++){ eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); SetEWeaponMovement(e, EWM_SINE_WAVE, 20, Rand(15, 40)); // e->CollDetection = false; Curse_Waitframes(this, ghost, vars, 15); } } } } int CountSpires(int vars){ int SpireX = vars[2]; int counter; for(int i = 0; i<20; i++){ if(SpireX[i] != 0) counter++; } return(counter); } void ShockwaveSpire(int startx, int starty, int endx, int endy, int vars){ int SpireShockX = vars[0]; int SpireShockY = vars[1]; int SpireX = vars[2]; int SpireY = vars[3]; int SpireTimer = vars[4]; SpireShockX[vars[5]] = startx; SpireShockY[vars[5]] = starty; SpireX[vars[5]] = endx; SpireY[vars[5]] = endy; vars[5]++; if(vars[5] == 20) vars[5] = 0; } void Curse_Waitframe(ffc this, npc ghost, int vars){ int SpireShockX = vars[0]; int SpireShockY = vars[1]; int SpireX = vars[2]; int SpireY = vars[3]; int SpireTimer = vars[4]; int BubbleX = vars[10]; int BubbleY = vars[11]; int BubbleStep = vars[12]; int BubblePattern = vars[13]; int BubbleTile = vars[15]; if(G[G_GLOBALFRAMES] % 20 == 0){ BubbleX[vars[14]] = Ghost_X + Rand(0, 32); BubbleY[vars[14]] = Ghost_Y + Rand(0, 32); BubbleStep[vars[14]] = Rand(1, 3); // if(Rand(0,1) == 0) BubblePattern[vars[14]] = 0; // else // BubblePattern[vars[14]] = Rand(1,20); BubbleTile[vars[14]] = 511; if(Rand(0,5) == 0) BubbleTile[vars[14]] = 512; vars[14]++; if(vars[14] == 50) vars[14] = 0; } for(int i = 0; i<50; i++){ if(BubbleX[i] != 0){ if(Offscreen(BubbleX[i], BubbleY[i])){ BubbleX[i] = 0; } else{ Screen->FastTile(6, BubbleX[i], BubbleY[i], BubbleTile[i], 0, OP_OPAQUE); if(BubblePattern[i] == 0) BubbleY[i] -= BubbleStep[i]; else{ BubblePattern[i] += 2; int offset= 2*Sin(BubblePattern[i]); int curx = BubbleX[i]; int cury = BubbleY[i]; curx += BubbleStep[i]*Cos(270); cury += BubbleStep[i]*Sin(270); BubbleX[i] = curx+offset*Cos(270)+90; BubbleY[i] = cury+offset*Sin(270)+90; } } } } for(int i = 0; i<20; i++){ if(SpireX[i] != 0){ if(Distance(SpireShockX[i], SpireShockY[i], SpireX[i], SpireY[i]) > 4){ Screen->FastCombo(2, SpireShockX[i], SpireShockY[i], 4991, 3, OP_OPAQUE); Game->PlaySound(1); SpireShockX[i] += VectorX(1.5, Angle(SpireShockX[i], SpireShockY[i], SpireX[i], SpireY[i])); SpireShockY[i] += VectorY(1.5, Angle(SpireShockX[i], SpireShockY[i], SpireX[i], SpireY[i])); if(Distance(SpireShockX[i], SpireShockY[i], Link->X, Link->Y) < 8){ SpireX[i] = SpireShockX[i]; SpireY[i] = SpireShockY[i]; } } else{ if(SpireTimer[i] == 0){ Game->PlaySound(30); } if(SpireTimer[i] < 360){ Screen->FastCombo(2, SpireX[i], SpireY[i], 4995, 2, OP_OPAQUE); } else if(SpireTimer[i] < 420){ Screen->FastCombo(2, SpireX[i], SpireY[i], 4987, 2, OP_OPAQUE); } if(SpireTimer[i] < 420){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, SpireX[i], SpireY[i], 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } if(SpireTimer[i] == 420){ eweapon e = FireAimedEWeapon(EW_BOMBBLAST, SpireX[i], SpireY[i], 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SpireX[i] = 0; SpireY[i] = 0; SpireShockX[i] = 0; SpireShockY[i] = 0; SpireTimer[i] = 0; } else SpireTimer[i]++; } } } if(vars[7] > 0){ if(vars[8] == 0){ eweapon e = FireEWeapon(EW_SCRIPT1, Clamp(Link->X + Rand(-24, 24), 32, 208), Clamp(Link->Y + Rand(-24, 24), 32, 128), 0, 0, ghost->WeaponDamage, 144, 38, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_FALL, 100, EWMF_DIE); SetEWeaponDeathEffect(e, EWD_EXPLODE, ghost->WeaponDamage); vars[8] = 60; vars[7]--; } } if(vars[8] > 0) vars[8]--; for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_SCRIPT2 && LinkCollision(e) && Link->Action == LA_GOTHURTLAND){ G[G_DEFCURSE] = 300; lweapon l = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y); l->UseSprite(146); l->DeadState = l->NumFrames*l->ASpeed; l->CollDetection = false; Remove(e); DamageLink(ghost->WeaponDamage); } if(e->Z > 0) Screen->FastTile(2, e->X, e->Y, 27401, 7, OP_OPAQUE); if(e->ID == EW_SBOMBBLAST && e->Misc[0] == 1 && Collision(ghost, e)){ vars[9]++; e->Misc[0] = 2; Game->PlaySound(107); int stop = vars[14]; for(int i = stop; i=50) j = 0+i-50; BubbleX[j] = Ghost_X + Rand(0, 32); BubbleY[j] = Ghost_Y + Rand(0, 32); BubbleStep[j] = Rand(1, 5); // if(Rand(0,1) == 0) BubblePattern[j] = 0; // else // BubblePattern[j] = Rand(1,20); BubbleTile[j] = 511; if(Rand(0,5) == 0) BubbleTile[j] = 512; vars[14]++; if(vars[14] == 50) vars[14] = 0; } } } if(vars[9] >= 15 && vars[6] == 0){ vars[6] = 1; eweapon e = FireEWeapon(EW_SBOMBBLAST, Ghost_X + 8, Ghost_Y + 8, 0, 0, ghost->WeaponDamage, -1, -1, 0); Game->PlaySound(98); Ghost_Data += 2; int SpecialDefenses[18] = {NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE}; Ghost_SetDefenses(ghost, SpecialDefenses); int stop = vars[14]; for(int i = stop; i=50) j = 0+i-50; BubbleX[j] = Ghost_X + Rand(0, 32); BubbleY[j] = Ghost_Y + Rand(0, 32); BubbleStep[j] = Rand(1, 5); // if(Rand(0,1) == 0) BubblePattern[j] = 0; // else // BubblePattern[j] = Rand(1,20); BubbleTile[j] = 511; if(Rand(0,5) == 0) BubbleTile[j] = 512; vars[14]++; if(vars[14] == 50) vars[14] = 0; } } if(G[G_GLOBALFRAMES] % 450 == 0 && Screen->NumNPCs() < 3){ npc n = QuickSpawn(184); n->X = Ghost_X+8; n->Y = Ghost_Y+8; } if(!Ghost_Waitframe(this, ghost, false, false)){ Game->PlaySound(108); Ghost_Explode(this, ghost); for(int i = Screen->NumNPCs(); i>0; i--){ npc n = Screen->LoadNPC(i); n->Y = -1000; n->HP = -10000; } int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); Quit(); } } void Curse_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iSetRenderTarget(RT_ITEMPOPUP); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap Screen->DrawTile(6, 0, 0, 62968, 10, 5, 11, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Draw the item frame Screen->FastTile(6, 72, 8, tile, cset, OP_OPAQUE); //Draw the item Screen->SetRenderTarget(RT_SCREEN); StartTangoMessagePortraitless(message, STYLE_ITEM, 300, 300); // Screen->SetRenderTarget(RT_ITEMPOPUP); // Screen->DrawBitmap(6, __TANGO_BITMAP, 0, 0, 248, 168, 8, 40, 248, 168, 0, true); // Screen->SetRenderTarget(RT_SCREEN); // Tango_ClearSlot(0); G[G_ITEMPOPUP] = 257; G[G_ITEMPOPUPTWO] = 0; G[G_ITEMPOPUPTYPE] = 1; FreezeScreen(); } ffc script BooBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_MOVE_OFFSCREEN); Ghost_Data = 5688; Ghost_CSet = 8; int BooX[20]; int BooY[20]; int BooAngleOffset[20]; int BooValid[20]; int BooCombo[20]; int vars; //This barely got any use here int LastPattern = 0; int Pattern = 0; int Attack; int LastAttack; int HPThreshold = 1000; int CurHP; int Xloc; int Yloc; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); Ghost_X = 300; Boo_Waitframes(this, ghost, vars, 60); while(true){ //First, introduce the flame pattern do{ Pattern = Rand(1,5); } while(Pattern == LastPattern); LastPattern = Pattern; //Copy the flags over for (int i = 0; i < 176; i++){ Screen->ComboF[i] = Game->GetComboFlag(7,0x70 + Pattern - 1,i); } //Now set the ScreenD and run the script Screen->D[0] = Pattern; RunFFCScript(60, NULL); //And wait so the player can see the pattern Boo_Waitframes(this, ghost, vars, 300); //Now we attack do{ Attack = Rand(1,4); } while(Attack == LastAttack || ((Attack == 2 || Attack == 3) && (Pattern == 3 || Pattern == 4))); LastAttack = Attack; int CurHP = Ghost_HP; if(Attack == 1){ while(Ghost_HP >= CurHP - HPThreshold){ Ghost_Dir = DIR_DOWN; do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 40); for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Ghost_X = Xloc; Ghost_Y = Yloc; for(int i = 0; i<30; i++){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Boo_Waitframe(this, ghost, vars); } for(int i = -45; i<=45; i+=45){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(i), 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING, DegtoRad(0.75), 120); } Boo_Waitframes(this, ghost, vars, 150); Ghost_X = 300; for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Boo_Waitframes(this, ghost, vars, 120); } } if(Attack == 2){ bool Target; int otherangle; int dist = 16; int Thex; int They; Ghost_Dir = DIR_DOWN; Game->PlaySound(84); while(Ghost_HP >= CurHP - HPThreshold){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Thex = Link->X + VectorX(dist, otherangle); They = Link->Y + VectorY(dist, otherangle); if(!Target){ Ghost_Vx = Clamp(Ghost_Vx+Sign(Link->X-Ghost_X+8)*0.1, -1, 1); Ghost_Vy = Clamp(Ghost_Vy+Sign(Link->Y-Ghost_Y+8)*0.1, -1, 1); } else{ Ghost_Vx = Clamp(Ghost_Vx+Sign(Thex-Ghost_X+8)*0.1, -1.25, 1); Ghost_Vy = Clamp(Ghost_Vy+Sign(They-Ghost_Y+8)*0.1, -1.25, 1); } if(Rand(0, 180) == 0) Target = !Target; if(G[G_GLOBALFRAMES] % 120 == 0) eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); otherangle+=5; Boo_Waitframe(this, ghost, vars); } Ghost_Vx = 0; Ghost_Vy = 0; Xloc = Ghost_X; Yloc = Ghost_Y; Ghost_X = 300; for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Boo_Waitframes(this, ghost, vars, 90); } if(Attack == 3){ Ghost_Dir = DIR_DOWN; do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 40); for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Ghost_X = Xloc; Ghost_Y = Yloc; Boo_Waitframes(this, ghost, vars, 60); while(Ghost_HP >= CurHP - HPThreshold){ do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Ghost_X, Ghost_Y, GridX(Xloc), GridY(Yloc)) < 40); while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 2, 0); if(G[G_GLOBALFRAMES] % 15 == 0) eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 0, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)); Boo_Waitframe(this, ghost, vars); } Boo_Waitframes(this, ghost, vars, 15); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_SCRIPT2){ e->Angle = DegtoRad(Angle(e->X, e->Y, Link->X, Link->Y)); e->Step = 350; } } Boo_Waitframes(this, ghost, vars, 45); } Xloc = Ghost_X; Yloc = Ghost_Y; Ghost_X = 300; for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Boo_Waitframes(this, ghost, vars, 90); } if(Attack == 4){ while(Ghost_HP >= CurHP - HPThreshold){ Ghost_Dir = DIR_DOWN; do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 40); for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Ghost_X = Xloc; Ghost_Y = Yloc; for(int i = 0; i<30; i++){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Boo_Waitframe(this, ghost, vars); } FireAimedEWeapon(EW_SCRIPT2, Link->X, Link->Y + 48, 0, 0, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); FireAimedEWeapon(EW_SCRIPT2, Link->X, Link->Y - 48, 0, 0, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); FireAimedEWeapon(EW_SCRIPT2, Link->X + 48, Link->Y, 0, 0, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); FireAimedEWeapon(EW_SCRIPT2, Link->X - 48, Link->Y, 0, 0, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); Xloc = Link->X; Yloc = Link->Y; Boo_Waitframes(this, ghost, vars, 30); for(int i = 45; i<=360-45; i+=90){ FireAimedEWeapon(EW_SCRIPT3, Xloc + VectorX(48, i), Yloc + VectorY(48, i), 0, 0, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); } Boo_Waitframes(this, ghost, vars, 45); for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_SCRIPT2){ e->Step = 250; } } Boo_Waitframes(this, ghost, vars, 60); for(int i = Screen->NumEWeapons(); i>0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_SCRIPT3){ e->Angle = DegtoRad(Angle(e->X, e->Y, Link->X, Link->Y)); e->Step = 250; } } Boo_Waitframes(this, ghost, vars, 90); Xloc = Ghost_X; Yloc = Ghost_Y; Ghost_X = 300; for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, Ghost_Data+1, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Boo_Waitframes(this, ghost, vars, 90); } } //Now we play ring around the rosie //Start by getting rid of the old pattern for(int i = 1; i<=32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 60){ f->Script = 0; f->Data = 0; Game->PlaySound(84); } } int number = 3 + vars; int radius = 56; int offset = Rand(0,3); int combo = 4245 + offset; bool breakflag; bool successflag; int angle; int otherangle; int timer; for(int i = 0; i<20; i++){ if(i>=number){ BooX[i] = -1; BooY[i] = -1; BooAngleOffset[i] = -1; BooValid[i] = 0; } else{ angle+=360/number; BooAngleOffset[i] = angle; BooValid[i] = 1; BooCombo[i] = combo; } } int leader = Rand(0, number-1); BooValid[leader] = 2; BooCombo[leader] = 4348 + offset; for(int i = 0; i<20; i++){ BooX[i] = Link->X + VectorX(radius, BooAngleOffset[i] + angle); BooY[i] = Link->Y + VectorY(radius, BooAngleOffset[i] + angle); if(G[G_GLOBALFRAMES] % 2 == 0){ for(int i = 0; iFastCombo(2, BooX[i], BooY[i], BooCombo[i], Ghost_CSet, OP_TRANS); } Boo_Waitframe(this, ghost, vars); } Game->PlaySound(84); Xloc = Link->X; Yloc = Link->Y; while(!breakflag){ angle+=1.5; if(angle >= 360) angle-=360; for(int i = 0; i<20; i++){ if(BooValid[i] != 0){ BooX[i] = Xloc + VectorX(radius, BooAngleOffset[i] + angle); BooY[i] = Yloc + VectorY(radius, BooAngleOffset[i] + angle); Screen->FastCombo(2, BooX[i], BooY[i], BooCombo[i], 8, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 6, BooX[i]+8, BooY[i]+8, 8)) DamageLink(ghost->Damage); if(timer%120 == 0 && timer != 0 && i % 2 != 0){ FireAimedEWeapon(EW_SCRIPT1, BooX[i], BooY[i], 0, 150, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); } } } // int Thex = Link->X;// + VectorX(dist, otherangle); // int They = Link->Y;// + VectorY(dist, otherangle); int Thex = 120;// + VectorX(dist, otherangle); int They = 80;// + VectorY(dist, otherangle); Xloc += Clamp(Sign(Thex-this->X+8)*0.1, -0.5, 0.5); Yloc += Clamp(Sign(They-this->Y+8)*0.1, -0.5, 0.5); otherangle+=5; for(int j = Screen->NumLWeapons(); j>0; j--){ lweapon l = Screen->LoadLWeapon(j); if(l->ID != LW_BOMB && l->CollDetection){ for(int i = 0; i<20; i++){ if(BooValid[i] != 0){ if(Distance(BooX[i], BooY[i], l->X, l->Y) < 16){ if(BooValid[i] == 2){ Remove(l); breakflag = true; successflag = true; break; } else{ breakflag = true; lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, BooX[i], BooY[i]); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; break; } } } } } } timer++; if(timer == 8*60){ breakflag = true; break; } Boo_Waitframe(this, ghost, vars); } if(successflag){ Game->PlaySound(110); for(int i = 0; i<20; i++){ if(BooValid[i] == 1){ lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, BooX[i], BooY[i]); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; } else if(BooValid[i] == 2){ Xloc = BooX[i]; Yloc = BooY[i]; } } for(int i = 0; i<30; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(2, Xloc, Yloc, 5692, Ghost_CSet, OP_TRANS); Boo_Waitframe(this, ghost, vars); } vars++; if(vars==4){ Ghost_X = Xloc; Ghost_Y = Yloc; } Ghost_HP = CurHP; } else{ Game->PlaySound(109); for(int i = 0; i<20; i++){ if(BooValid[i] == 1){ lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, BooX[i], BooY[i]); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; } } for(int j = 0; j<30; j++){ for(int i = 0; i<20; i++){ if(BooValid[i] == 2){ Screen->FastCombo(2, BooX[i], BooY[i], BooCombo[i], 8, OP_TRANS); } } Boo_Waitframe(this, ghost, vars); } Boo_Waitframes(this, ghost, vars, 30); for(int i = 0; i<150; i++){ if(G[G_GLOBALFRAMES] % 2 == 0) Screen->FastCombo(3, Link->X, Link->Y, Ghost_Data+1, Ghost_CSet, OP_TRANS); if(i % 50 == 0) DamageLink(ghost->Damage); Boo_Waitframe(this, ghost, vars); } Ghost_HP = CurHP; } Boo_Waitframe(this, ghost, vars); } } void Boo_Waitframe(ffc this, npc ghost, int vars){ Ghost_Waitframe(this, ghost, false, false); if(vars == 4){ lweapon explosion; int baseX=Ghost_X+ghost->DrawXOffset; int baseY=(Ghost_Y+ghost->DrawYOffset)-(Ghost_Z+ghost->DrawZOffset); __DeathAnimStart(this, ghost); __DeathAnimSFX(ghost->ID, ghost->X); // if(flash) // __Ghost_FlashCounter=10000; // else __Ghost_FlashCounter=0; // One explosion every 16 frames, 15 times for(int i=0; i<15; i++) { explosion=Screen->CreateLWeapon(LW_BOMBBLAST); explosion->X=baseX+Rand(16*Ghost_TileWidth)-8; explosion->Y=baseY+Rand(16*Ghost_TileHeight)-8; explosion->CollDetection=false; for(int j=0; j<16; j++) { Ghost_SetPosition(this, ghost); // Make sure it doesn't wander off // if(flash) // __Ghost_UpdateFlashing(this, ghost); Ghost_WaitframeLight(this, ghost); } } Ghost_X = 300; ghost->X = 300; int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); int Args[8]; if(G[G_POSTBOSSFIVESCENE] == 0){ Args[0] = 14; RunFFCScript(8, Args); } else if(G[G_POSTBOSSSIXSCENE] == 0 && G[G_POSTLEVELFIVESCENE] == 1){ Args[0] = 17; RunFFCScript(8, Args); } while(CountFFCsRunning(8) > 0) Ghost_WaitframeLight(this, ghost); __DeathAnimEnd(this, ghost); Quit(); } } void Boo_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iD[0]; // int pattern = 4; bool hitthisframe; int nextflag; if(pattern == 1){ for(int j = 0; j<45; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 37 || Screen->ComboI[i] == 37){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } if(j == 30) Game->PlaySound(87); Waitframe(); } while(true){ for(int k = 37; k<=42; k++){ nextflag = k+1; if(nextflag == 43) nextflag = 37; for(int j = 0; j<90; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == k || Screen->ComboI[i] == k){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(4); hitthisframe = true; } } } if(j== 75) Game->PlaySound(87); if(j>45){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == nextflag || Screen->ComboI[i] == nextflag){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } } hitthisframe = false; Waitframe(); } Game->PlaySound(84); } } } if(pattern == 2){ for(int j = 0; j<50; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 37 || Screen->ComboI[i] == 37){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } if(j == 35) Game->PlaySound(87); Waitframe(); } while(true){ for(int k = 37; k<=40; k++){ int flag = k; nextflag = k+1; if(k == 39) nextflag = 38; if(k == 40){ flag = 38; nextflag = 37; } for(int j = 0; j<150; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == flag || Screen->ComboI[i] == flag){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(4); hitthisframe = true; } } } if(j== 135) Game->PlaySound(87); if(j>100){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == nextflag || Screen->ComboI[i] == nextflag){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } } hitthisframe = false; Waitframe(); } Game->PlaySound(84); } } } if(pattern == 3){ for(int j = 0; j<90; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 37 || Screen->ComboI[i] == 37){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } if(j == 45) Game->PlaySound(87); Waitframe(); } while(true){ for(int k = 37; k<=39; k++){ int flag = k; nextflag = k+1; if(k == 39) nextflag = 37; for(int j = 0; j<150; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == flag || Screen->ComboI[i] == flag){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(4); hitthisframe = true; } } } if(j== 105) Game->PlaySound(87); if(j>60){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == nextflag || Screen->ComboI[i] == nextflag){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } } hitthisframe = false; Waitframe(); } Game->PlaySound(84); } } } if(pattern == 4){ while(true){ Game->PlaySound(87); for(int j = 0; j<30; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 37 || Screen->ComboI[i] == 37 || Screen->ComboF[i] == 39 || Screen->ComboI[i] == 39){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } Waitframe(); } for(int j = 0; j<360; j++){ if(j>120 && j<=150){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 38 || Screen->ComboI[i] == 38){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } } if(j == 135) Game->PlaySound(87); if(j>150){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 38 || Screen->ComboI[i] == 38 || Screen->ComboF[i] == 39 || Screen->ComboI[i] == 39){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(4); hitthisframe = true; } } } } else{ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 37 || Screen->ComboI[i] == 37 || Screen->ComboF[i] == 39 || Screen->ComboI[i] == 39){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(4); hitthisframe = true; } } } } hitthisframe = false; Waitframe(); } Game->PlaySound(84); Waitframes(60); } } if(pattern == 5){ while(true){ for(int k = 37; k<=38; k++){ for(int j = 0; j<80; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == k || Screen->ComboI[i] == k){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_TRANS); } } if(j==65) Game->PlaySound(87); Waitframe(); } for(int j = 0; j<360; j++){ for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == k || Screen->ComboI[i] == k){ Screen->FastCombo(2, ComboX(i), ComboY(i), 4242, 0, OP_OPAQUE); if(CircleCollision(Link->X+8, Link->Y+8, 4, ComboX(i)+8, ComboY(i)+8, 4) && !hitthisframe){ DamageLink(4); hitthisframe = true; } } } hitthisframe = false; Waitframe(); } Game->PlaySound(84); Waitframes(90); } } } } } int GetNPCNumber(npc a){ int Num = 0; for(int i=1; i<=Screen->NumNPCs(); i++){ npc b = Screen->LoadNPC(i); if(a==b)return i; } return -1; } ffc script PatraBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_MOVE_OFFSCREEN); Ghost_Transform(this, ghost, 5696, 8, 2, 2); npc Eyes[6]; int V_EYEANGLE = 1; int V_EYEDISTANCE = 0; //20 when retracted, 110 when expanded, 65 in the middle int vars[] = {0, 0}; int counter = -1; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); for(int i=0; i<6; i++){ Eyes[i] = CreateNPCAt(187, Ghost_X+8, Ghost_Y+8); Eyes[i]->Misc[5] = GetNPCNumber(ghost); } for(int i=0; i<20; i++){ vars[V_EYEANGLE]+=4; vars[V_EYEDISTANCE]+=1; Patra_Waitframe(this, ghost, Eyes, vars); } int MainAngle = Angle(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y); int Cooldown = 60; int Attack; int DistChoice; int speed = 0.8; while(true){ Ghost_MoveAtAngle(MainAngle, speed, 0); MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); if(Cooldown>0)Cooldown--; else if(Rand(0, 120)==0){ int Attack = Rand(0,2); if(Attack==0){ for(int i = 0; i<60; i++){ // Ghost_MoveAtAngle(MainAngle, 1, 0); // MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); // vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); // if(G[G_GLOBALFRAMES] % 4 == 0){ // if(Ghost_CSet == 8) // Ghost_CSet = 7; // else // Ghost_CSet = 8; // } // Patra_Waitframe(this, ghost, Eyes, vars); vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); Patra_Waitframe(this, ghost, Eyes, vars); } Ghost_CSet = 8; int Pick[3]; for(int i = 0; i<3; i++){ // do{ // Pick[i] = Rand(0,7); // } // while((i == 1 && Pick[0] == Pick[i]) || (i == 2 && (Pick[0] == Pick[i] || Pick[1] == Pick[i]))); // for(int j=-1; j<=1; j++){ // eweapon e = FireAimedEWeapon(EW_BEAM, Eyes[i]->X, Eyes[i]->Y, DegtoRad(30*j), 200, ghost->WeaponDamage, 39, 13, EWF_ROTATE_360); // } for(int j=-1; j<=1; j++){ eweapon e = FireAimedEWeapon(EW_BEAM, Ghost_X+8, Ghost_Y+8, DegtoRad(30*j), 200, ghost->WeaponDamage, 39, 13, EWF_ROTATE_360); } vars[V_EYEANGLE]+=1; Patra_Waitframes(this, ghost, Eyes, vars, 30); } } else if(Attack==1){ for(int i = 0; i<120; i++){ Ghost_MoveAtAngle(MainAngle, speed, 0); MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); if(G[G_GLOBALFRAMES] % 4 == 0){ if(Ghost_CSet == 8) Ghost_CSet = 7; else Ghost_CSet = 8; } Patra_Waitframe(this, ghost, Eyes, vars); } int dir; for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 98){ dir = DIR_RIGHT; eweapon e = FireEWeapon(EW_ARROW, ComboX(i) + RussInFrontX(dir, -8) + 4, ComboY(i) + RussInFrontY(dir, -8), DegtoRad(DirAngle(dir)), 300, 4, -1, 1, EWF_ROTATE); } } for(int i=0; i<45; i++){ Ghost_MoveAtAngle(MainAngle, speed, 0); MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); Patra_Waitframe(this, ghost, Eyes, vars); } for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 99){ dir = DIR_LEFT; eweapon e = FireEWeapon(EW_ARROW, ComboX(i) + RussInFrontX(dir, -8) + 4, ComboY(i) + RussInFrontY(dir, -8), DegtoRad(DirAngle(dir)), 300, 4, -1, 1, EWF_ROTATE); } } for(int i=0; i<45; i++){ Ghost_MoveAtAngle(MainAngle, speed, 0); MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); Patra_Waitframe(this, ghost, Eyes, vars); } for(int i = 0; i<176; i++){ if(Screen->ComboF[i] == 100){ dir = DIR_DOWN; eweapon e = FireEWeapon(EW_ARROW, ComboX(i) + RussInFrontX(dir, -8) + 4, ComboY(i) + RussInFrontY(dir, -8), DegtoRad(DirAngle(dir)), 300, 4, -1, 1, EWF_ROTATE); } } for(int i=0; i<45; i++){ Ghost_MoveAtAngle(MainAngle, speed, 0); MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); vars[V_EYEANGLE]+=Round(2-Sin(G[G_GLOBALFRAMES])*1.5); Patra_Waitframe(this, ghost, Eyes, vars); } } else if(Attack==2){ int Shooter = 0; for(int i=0; i<10; i++){ if(Eyes[Shooter]->isValid()){ eweapon e = FireAimedEWeapon(EW_SCRIPT10, Eyes[Shooter]->X, Eyes[Shooter]->Y, 0, 180, 8, 13, SFX_WHIRLWIND, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING, DegtoRad(2)); SetEWeaponLifespan(e, EWL_SLOW_TO_HALT, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } for(int i=0; i<20; i++){ Ghost_MoveAtAngle(MainAngle, speed*0.4, 0); MainAngle = RadtoDeg(TurnTowards(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y, DegtoRad(MainAngle), 0.04)); vars[V_EYEANGLE]+=2; Patra_Waitframe(this, ghost, Eyes, vars); } Shooter++; if(Shooter>5)Shooter = 0; // for(int i=0; i<2&&(!Eyes[Shooter]->isValid()||!inScreen(Eyes[Shooter]->X+8, Eyes[Shooter]->Y)); i++){ // Shooter++; // if(Shooter>5)Shooter = 0; // } int incr = 0; int counter; while(true){ Shooter++; if(Shooter>5)Shooter = 0; incr++; if(incr>=2){ if(!Eyes[Shooter]->isValid()){ //Nothing } else if(!inScreen(Eyes[Shooter]->X+8, Eyes[Shooter]->Y)){ //Nothing } else break; } counter++; if(counter == 20) break; } } } if(Rand(0, 2) == 0){ do{ DistChoice = Choose(20, 110); } while(DistChoice == vars[V_EYEDISTANCE]); int Timer; int Expand = 0.75; if(vars[V_EYEDISTANCE]>=DistChoice){ Expand = -0.75; } while(vars[V_EYEDISTANCE] != DistChoice){ Timer++; Ghost_MoveAtAngle(MainAngle, 0.8, 0); vars[V_EYEANGLE]+=Round(2-Sin(Timer*1.5)*1.5); vars[V_EYEDISTANCE]+=Expand; Patra_Waitframe(this, ghost, Eyes, vars); } } Cooldown = 60; } Patra_Waitframe(this, ghost, Eyes, vars); } } void PlaceEyes(npc Eyes, int vars){ for(int i=0; i<6; i++){ if(Eyes[i]->isValid()){ int X = Ghost_X+8+VectorX(vars[0]+Sin(vars[1])*vars[0]/4, vars[1]+60*i); int Y = Ghost_Y+8+VectorY(vars[0]+Sin(vars[1])*vars[0]/4, vars[1]+60*i); if(X>-32&&X<272)Eyes[i]->X = X; else Eyes[i]->X = -32; if(Y>-32&&Y<192)Eyes[i]->Y = Y; } } } void Patra_Waitframe(ffc this, npc ghost, npc Eyes, int vars){ PlaceEyes(Eyes, vars); if(!Ghost_Waitframe(this, ghost, false, false)){ lweapon explosion; int baseX=Ghost_X+ghost->DrawXOffset; int baseY=(Ghost_Y+ghost->DrawYOffset)-(Ghost_Z+ghost->DrawZOffset); __DeathAnimStart(this, ghost); __DeathAnimSFX(ghost->ID, ghost->X); // if(flash) // __Ghost_FlashCounter=10000; // else __Ghost_FlashCounter=0; // One explosion every 16 frames, 15 times for(int i=0; i<15; i++) { explosion=Screen->CreateLWeapon(LW_BOMBBLAST); explosion->X=baseX+Rand(16*Ghost_TileWidth)-8; explosion->Y=baseY+Rand(16*Ghost_TileHeight)-8; explosion->CollDetection=false; for(int j=0; j<16; j++) { Ghost_SetPosition(this, ghost); // Make sure it doesn't wander off // if(flash) // __Ghost_UpdateFlashing(this, ghost); Ghost_WaitframeLight(this, ghost); } } Ghost_X = 300; ghost->X = 300; while(Screen->NumNPCs() > 1) Ghost_WaitframeLight(this, ghost); int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 2); int Args[8]; if(G[G_POSTBOSSFIVESCENE] == 0){ Args[0] = 14; RunFFCScript(8, Args); } else if(G[G_POSTBOSSSIXSCENE] == 0 && G[G_POSTLEVELFIVESCENE] == 1){ Args[0] = 17; RunFFCScript(8, Args); } while(CountFFCsRunning(8) > 0) Ghost_WaitframeLight(this, ghost); __DeathAnimEnd(this, ghost); Quit(); } } void Patra_Waitframes(ffc this, npc ghost, npc Eyes, int vars, int frames){ for(int i = 0; iAttributes[10]; Ghost_Transform(this, ghost, 4778, 8, 1, 1); npc parent = Screen->LoadNPC(ghost->Misc[5]); int MaxHP = Ghost_HP; while(parent->isValid()&&parent->CollDetection && Ghost_HP > MaxHP*0.25){ Ghost_Waitframe2(this, ghost, true, true); } ghost->Misc[5] = 0; int Angle = Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)+Rand(-45, 45); int VX = VectorX(2, Angle); int VY = VectorY(2, Angle); int maxspeed = 1.5; while(true){ if(Ghost_XX)VX+=0.03; else if(Ghost_X>Link->X)VX-=0.03; VX = Clamp(VX, -1*maxspeed, maxspeed); if(Ghost_YY)VY+=0.03; else if(Ghost_Y>Link->Y)VY-=0.03; VY = Clamp(VY, -1*maxspeed, maxspeed); Ghost_X+=VX; Ghost_Y+=VY; if(Rand(0, 180)==0){ int Attack; if(Screen->NumEWeapons()<8){ Attack = Choose(0, 0, 1); } else{ Attack = Choose(0, 0, 2); } Attack = Rand(0,1); if(Attack==0){ eweapon e = FireAimedEWeapon(EW_SCRIPT10, Ghost_X, Ghost_Y, DegtoRad(Rand(-45, 45)), 200, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); // SetEWeaponMovement(e, EWM_HOMING_REAIM, 2, 45); VX = Clamp(VX+VectorX(1, Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)), -1*maxspeed, maxspeed); VY = Clamp(VY+VectorY(1, Angle(Link->X, Link->Y, Ghost_X, Ghost_Y)), -1*maxspeed, maxspeed); } else if(Attack==1){ // int SavedLinkX[16]; // int SavedLinkY[16]; int SavedLinkX = Link->X; int SavedLinkY = Link->Y; Game->PlaySound(35); for(int i=0; i<32; i++){ // SavedLinkX[i] = Link->X; // SavedLinkY[i] = Link->Y; DrawLaser(3, Ghost_X+8, Ghost_Y+8, 2, Angle(Ghost_X, Ghost_Y, SavedLinkX, SavedLinkY), 0xBE); Ghost_Waitframe(this, ghost, true, true); } Game->PlaySound(32); for(int i=0; i<48; i++){ // for(int i=0; i<16; i++){ // if(i<15){ // SavedLinkX[i] = SavedLinkX[i+1]; // SavedLinkY[i] = SavedLinkY[i+1]; // } // else{ // SavedLinkX[i] = Link->X; // SavedLinkY[i] = Link->Y; // } // } // if(i<24)Laser3Color(3, Ghost_X+8, Ghost_Y+8, i/6, Angle(Ghost_X, Ghost_Y, SavedLinkX[0], SavedLinkY[0]), 0, 0xBC); // else Laser3Color(3, Ghost_X+8, Ghost_Y+8, 4, Angle(Ghost_X, Ghost_Y, SavedLinkX[0], SavedLinkY[0]), ghost->WeaponDamage, 0xBC); if(i%3 == 0) Game->PlaySound(73); Laser3Color(3, Ghost_X+8, Ghost_Y+8, 4, Angle(Ghost_X, Ghost_Y, SavedLinkX, SavedLinkY), ghost->WeaponDamage, 0xBC, 0xBD, 0xBE); Ghost_Waitframe(this, ghost, true, true); } } else if(Attack==2){ eweapon e = FireAimedEWeapon(EW_SCRIPT10, Ghost_X, Ghost_Y, 0, 100, ghost->WeaponDamage, 13, 59, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING, DegtoRad(1)); SetEWeaponLifespan(e, EWL_TIMER, 240); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } Ghost_Waitframe(this, ghost, true, true); } } } ffc script Abei{ void run(){ int Width = 16; int Height = 16; if((G[G_MIDPOINTSCENE] == 0 && G[G_NUMTEARS] == 4) || G[G_INTROSCENE] == 0){ SetLayerComboD(1, ComboAt(this->X, this->Y), 0); this->Data = 0; this->X = 0; this->Y = 0; } else SetLayerComboD(1, ComboAt(this->X, this->Y), 4950); while(true){ //Facing Up if((Link->Dir==DIR_UP&&Link->Y>=this->Y&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-8&&Link->X<=this->X+Width-8) || (Link->Dir==DIR_DOWN&&Link->Y>=this->Y-16&&Link->Y<=this->Y+Height-16&&Link->X>=this->X-8&&Link->X<=this->X+Width-8) || (Link->Dir==DIR_LEFT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X&&Link->X<=this->X+Width) || (Link->Dir==DIR_RIGHT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-16&&Link->X<=this->X+Width-16)){ if(CMB_NPC_CANTALK>0) Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128); if(Link->PressA){ Link->InputA = false; Link->PressA = false; int St1[] = "What can I do for you?"; PlayTangoString(St1, STYLE_OTHER, 84, 48, 8); int Tear[] = "Any leads on the next shrine?"; int Items[] = "Any advice on things I should be looking for?"; int Nothing[] = "I'm good for now."; int Choices[] = {Tear, Items, Nothing}; int CYes = 1; int CNo = 6; int handler[6]; while(handler[1] == 0){ DialogueBox_RunSingleFrame(handler, 48+30+50, 8+52, Choices, TIL_DB_DIALOGUE_BOX, CS_DB_DIALOGUE_BOX, C_DB_DIALOGUE_BOX_BG, FONT_Z3SMALL, 1, TIL_DB_DIALOGUE_SELECTOR, CS_DB_DIALOGUE_SELECTOR); WaitNoAction(); } Tango_ClearSlot(0); if(handler[0] == 0){ if(G[G_NUMTEARS] < 3){ // if(G[G_NUMTEARS] == 0){ if(!Game->GetScreenState(1, 0x24, ST_ITEM)){ int St2[] = "I have heard of a shrine that used to exist in a desert in central Hyrule. That may be a good place to start looking."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } // } // if(G[G_NUMTEARS] == 1){ else if(!Game->GetScreenState(2, 0x15, ST_ITEM)){ int St2[] = "There supposedly was a shrine in a large cavern, full of monuments and statues, in eastern Hyrule. I've heard a tunnel once existed under a pond to the east. Perhaps you could find that tunnel to take you there."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } // } // if(G[G_NUMTEARS] == 2){ else if(!Game->GetScreenState(4, 0x52, ST_ITEM)){ int St2[] = "They say a secret cave in western Hyrule lead to a series of floating islands with a shrine. While those floating islands probably are no longer floating, the path may still exist."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } // } } else if(G[G_NUMTEARS] == 3){ int St2[] = "A shrine once existed in Hyrule Field, but that would be deep down in the Great Chasm now. Perhaps you could find a way down to there from above water?"; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(G[G_NUMTEARS] < 7){ // if(G[G_NUMTEARS] == 4){ if(!Game->GetScreenState(7, 0x63, ST_ITEM)){ int St2[] = "There was apparently a ship transporting a Tear of Light that sunk to the west. It is possible that you could find it on the ocean floor still."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } // } // if(G[G_NUMTEARS] == 5){ else if(!Game->GetScreenState(13, 0x14, ST_ITEM)){ int St2[] = "A shrine existed on a mountain top to the east of here once. I imagine that is now the jungle island. The entrance to the jungle is sealed, but there was apparently a secret entrance from below."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } // } // if(G[G_NUMTEARS] == 6){ else if(!Game->GetScreenState(14, 0x42, ST_ITEM)){ int St2[] = "Death Mountain, a large volcano in the northwest that even now breaches the surface of the waves, is said to have a shrine hidden within its crater."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } // } } else if(G[G_NUMTEARS] == 7){ int St2[] = "The large tower to the north apparently used to be a shrine. The entrance seems to be locked though, so I'm not sure how you would reach it."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(G[G_NUMTEARS] == 8){ int St2[] = "You have all the Tears already. I'm not sure there's anymore I can help you with."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } } if(handler[0] == 1){ int string; int failsafe; if(Link->Item[186] && Link->Item[174] && (Link->Item[177] || G[G_RIGGSJOINED] == 0) && (Link->Item[68] || G[G_RIGGSJOINED] == 0) && (Link->Item[211] || G[G_RIGGSJOINED] == 0)&& (Link->Item[212] || G[G_RIGGSJOINED] == 0) && (Link->Item[41] || !Link->Item[11]) && (Link->Item[221] || !(Link->Item[213] && Link->Item[27])) && (Link->Item[220] || !Link->Item[52])) string = 9; do{ string = Rand(0,8); failsafe++; if(failsafe == 100) break; } while((string == 0 && Link->Item[186]) || (string == 1 && Link->Item[174]) || (string == 2 && (Link->Item[177] || G[G_RIGGSJOINED] == 0)) || (string == 3 && (Link->Item[68] || G[G_RIGGSJOINED] == 0)) || (string == 4 && (Link->Item[211] || G[G_RIGGSJOINED] == 0 || !Link->Item[213]))|| (string == 5 && (Link->Item[212] || G[G_RIGGSJOINED] == 0 || !Link->Item[27])) || (string == 6 && (Link->Item[41] || !Link->Item[11])) || (string == 8 && (Link->Item[221] || !(Link->Item[213] && Link->Item[27]))) || (string == 7 && (Link->Item[220] || !Link->Item[52]))); if(failsafe == 100) string = 9; if(string == 0){ int St2[] = "The jungle isle to the east of here is said to have a magic mirror that reveals monsters' stamina. The tall cliffs prevent reaching the island from the surface, but perhaps a path to it exists from below the water?"; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 1){ int St2[] = "Records speak of a magical artifact that points to the location of other items. It was hidden in the mountains north of Hyrule Field, which are now the peaks above the Great Chasm."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 2){ int St2[] = "I heard that a ship carrying some improved bombs sank to the west. Its cargo may still be on the ocean floor."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 3){ int St2[] = "A sturdy bow was apparently once hidden on Death Mountain. It could be worth looking for."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 4){ int St2[] = "Legend says the Zora once hid a prized trident in the northeast of Hyrule. It might serve you better than the one you're using now."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 5){ int St2[] = "The Gerudo are said to have hidden a powerful weapon within Spectacle Rock. It might be worth investigating."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 6){ int St2[] = "Someone told me they saw a wallet wash ashore south of the Coral Atoll. Could help you hold more rupees for some of those big purchases I've seen you eying."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 7){ int St2[] = "I heard that the Keep of Flames has a secret entrance from the very top of Death Mountain. There may be something worthwhile hidden there."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 8){ int St2[] = "A magical arrow was apparently hidden in the Jungle Temple, in a place accessible only from a secret entrance on an adjacent hilltop."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } else if(string == 9){ int St2[] = "I don't know of anything useful at the moment, though I'll keep my ears open and let you know what I find."; PlayTangoString(St2, STYLE_OTHER, 84, 48, 8); } } } } Waitframe(); } } } ffc script Difficultychange{ void run(){ int Width = 16; int Height = 16; while(true){ //Facing Up if((Link->Dir==DIR_UP&&Link->Y>=this->Y&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-8&&Link->X<=this->X+Width-8) || (Link->Dir==DIR_DOWN&&Link->Y>=this->Y-16&&Link->Y<=this->Y+Height-16&&Link->X>=this->X-8&&Link->X<=this->X+Width-8) || (Link->Dir==DIR_LEFT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X&&Link->X<=this->X+Width) || (Link->Dir==DIR_RIGHT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-16&&Link->X<=this->X+Width-16)){ if(CMB_NPC_CANTALK>0) Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128); if(Link->PressA){ Link->InputA = false; Link->PressA = false; if(Screen->D[0] == 0){ int St1[] = "Is your adventure too difficult for you? Or perhaps you wish things were a little more challenging. Whatever your wish, I can help out. My magic can influence the difficulty of the world. What do you say? Interested?"; PlayTangoString(St1, STYLE_OTHER, 4638, 48, 8); Screen->D[0] = 1; } else{ int St1[] = "Back again? Do you have need for my control over difficulty?"; PlayTangoString(St1, STYLE_OTHER, 4638, 48, 8); } int Yes[] = "Yes"; int No[] = "No"; int Choices[] = {Yes, No}; int CYes = 1; int CNo = 6; int handler[6]; while(handler[1] == 0){ DialogueBox_RunSingleFrame(handler, 48+30+50, 8+52, Choices, TIL_DB_DIALOGUE_BOX, CS_DB_DIALOGUE_BOX, C_DB_DIALOGUE_BOX_BG, FONT_Z3SMALL, 1, TIL_DB_DIALOGUE_SELECTOR, CS_DB_DIALOGUE_SELECTOR); WaitNoAction(); } Tango_ClearSlot(0); if(handler[0] == 0){ int St2[] = "How difficult shall I make your journey?"; PlayTangoString(St2, STYLE_OTHER, 4638, 48, 8); int Relaxed[16] = "Relaxed"; int Easy[16] = "Easy"; int Normal[16] = "Normal"; int Hard[16] = "Hard"; int Insane[16] = "Insane"; int Choices2[] = {Relaxed, Easy, Normal, Hard, Insane}; int handler2[6]; while(handler2[1] == 0){ DialogueBox_RunSingleFrame(handler2, 48+30+50, 8+52, Choices2, TIL_DB_DIALOGUE_BOX, CS_DB_DIALOGUE_BOX, C_DB_DIALOGUE_BOX_BG, FONT_Z3SMALL, 1, TIL_DB_DIALOGUE_SELECTOR, CS_DB_DIALOGUE_SELECTOR); WaitNoAction(); } if(handler2[0] == 0) G[G_DIFFICULTY] = DIF_VEASY; if(handler2[0] == 1) G[G_DIFFICULTY] = DIF_EASY; if(handler2[0] == 2) G[G_DIFFICULTY] = DIF_NORMAL; if(handler2[0] == 3) G[G_DIFFICULTY] = DIF_HARD; if(handler2[0] == 4) G[G_DIFFICULTY] = DIF_VHARD; int St3[] = "It is done. Do come back if you are in need of my services again."; PlayTangoString(St3, STYLE_OTHER, 4638, 48, 8); } if(handler[0] == 1){ int St2[] = "Well, if you decide your are unhappy with your journey's difficulty, you know where to find me."; PlayTangoString(St2, STYLE_OTHER, 4638, 48, 8); } } } Waitframe(); } } } ffc script AquamentusBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); int V_STATE = 0; //0 == Lava, 1 == Lava, firing, 2 == flying, 3 == flying, firing int V_DIR = 1; int FireCombo[15]; int FireTimer[15]; int FireZ[15]; int vars[] = {0, 0, FireCombo, FireTimer, FireZ}; int counter = -1; int Music[] = "R6 - Boss.nsf"; Game->PlayEnhancedMusic(Music, 0); Ghost_X = 300; Ghost_Y = 80; int emergedir; int angle; int Xloc; int Yloc; int Attack; int Fireindex; while(true){ for(int i = Rand(2,4); i>0; i--){ do{ Xloc = GridX(Rand(32, 308)); Yloc = GridY(Rand(32, 128)); } while(Screen->ComboD[ComboAt(Xloc, Yloc)] != 5980 || Screen->ComboD[ComboAt(Xloc, Yloc)+1] != 5980 || Distance(Xloc, Yloc, Link->X, Link->Y) < 32); angle = Angle(48+8, 80+8, Link->X, Link->Y); if((angle > 90 && angle <=180) || (angle >= -180 && angle <=-90)) emergedir = 0; else emergedir = 1; Emerge(Xloc, Yloc, emergedir, false, this, ghost, vars); Aquamentus_Waitframes(this, ghost, vars, 60); Attack = Rand(0,3); if(Attack == 0){ vars[V_STATE] = 1; for(int j = 0; j<7; j++){ eweapon e = FireEWeapon(EW_SCRIPT2, Ghost_X+8, Ghost_Y, DegtoRad(270), 500, 0, 38, 93, 0); e->CollDetection = false; Aquamentus_Waitframes(this, ghost, vars, 5); } Aquamentus_Waitframes(this, ghost, vars, 60); int flag = Rand(38,42); for(int j = 0; j<176; j++){ if(Screen->ComboF[j] == flag){ FireCombo[Fireindex] = j; FireTimer[Fireindex] = 450; FireZ[Fireindex] = 100; Fireindex++; if(Fireindex == 15) Fireindex = 0; } } vars[V_STATE] = 0; } else if(Attack == 1){ vars[V_STATE] = 1; Game->PlaySound(35); angle = Angle(Ghost_X+8, Ghost_Y, Link->X, Link->Y); Aquamentus_Waitframes(this, ghost, vars, 60); for(int k = 0; k<16; k++){ for(int j=0; j<3; j++){ eweapon e = FireEWeapon(EW_FIREBALL, Ghost_X + 8, Ghost_Y, DegtoRad(angle + Rand(-30, 30)), 150, ghost->WeaponDamage, 35, 13, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 120); SetEWeaponDeathEffect(e, EWD_VANISH, NULL); } Aquamentus_Waitframes(this, ghost, vars, 6); } vars[V_STATE] = 0; } else if(Attack == 2){ vars[V_STATE] = 1; Aquamentus_Waitframes(this, ghost, vars, 15); for(int i = -45; i<=45; i+=45){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(i), 200, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING_REAIM, 2, 60); } Aquamentus_Waitframes(this, ghost, vars, 15); vars[V_STATE] = 0; } else if(Attack == 3){ vars[V_STATE] = 1; Aquamentus_Waitframes(this, ghost, vars, 15); for(int i = 0; i<=315; i+=45){ eweapon e = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(i), 200, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING_REAIM, 1, 20); } Aquamentus_Waitframes(this, ghost, vars, 15); vars[V_STATE] = 0; } Aquamentus_Waitframes(this, ghost, vars, 60); angle = Angle(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y); if((angle > 90 && angle <=180) || (angle >= -180 && angle <=-90)) emergedir = 0; else emergedir = 1; Submerge(Ghost_X, Ghost_Y, emergedir, false, this, ghost, vars); } do{ Xloc = GridX(Rand(32, 308)); Yloc = GridY(Rand(32, 128)); } while(Screen->ComboD[ComboAt(Xloc, Yloc)] != 5980 || Screen->ComboD[ComboAt(Xloc, Yloc)+1] != 5980 || Distance(Xloc, Yloc, Link->X, Link->Y) < 32); angle = Angle(48+8, 80+8, Link->X, Link->Y); if((angle > 90 && angle <=180) || (angle >= -180 && angle <=-90)) emergedir = 0; else emergedir = 1; Emerge(Xloc, Yloc, emergedir, true, this, ghost, vars); Aquamentus_Waitframes(this, ghost, vars, 60); for(int k = Rand(2,4); k>0; k--){ // bool Target; // int otherangle; int dist = 16; // int Thex; int They; for(int j = Rand(180, 360); j>0; j--){ // Thex = Link->X + VectorX(dist, otherangle); // They = Link->Y + VectorY(dist, otherangle); // if(!Target){ Ghost_Vx = Clamp(Ghost_Vx+Sign(Link->X-Ghost_X+8)*0.065, -0.5, 0.5); Ghost_Vy = Clamp(Ghost_Vy+Sign(Link->Y-Ghost_Y+8)*0.065, -0.5, 0.5); // } // else{ // Ghost_Vx = Clamp(Ghost_Vx+Sign(Thex-Ghost_X+8)*0.08, -1, 1); // Ghost_Vy = Clamp(Ghost_Vy+Sign(They-Ghost_Y+8)*0.08, -1, 1); // } // if(Rand(0, 180) == 0) // Target = !Target; if(G[G_GLOBALFRAMES] % 120 == 0) eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 250, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); // otherangle+=5; Aquamentus_Waitframe(this, ghost, vars); } Ghost_Vx = 0; Ghost_Vy = 0; Attack = Rand(1,3); if(Attack == 0){ vars[V_STATE] = 3; for(int j = 0; j<7; j++){ eweapon e = FireEWeapon(EW_SCRIPT2, Ghost_X+8, Ghost_Y, DegtoRad(270), 500, 0, 38, 93, 0); e->CollDetection = false; Aquamentus_Waitframes(this, ghost, vars, 5); } Aquamentus_Waitframes(this, ghost, vars, 60); int flag = Rand(38,42); for(int j = 0; j<176; j++){ if(Screen->ComboF[j] == flag){ FireCombo[Fireindex] = j; FireTimer[Fireindex] = 450; FireZ[Fireindex] = 100; Fireindex++; if(Fireindex == 15) Fireindex = 0; } } vars[V_STATE] = 2; } else if(Attack == 1){ vars[V_STATE] = 3; Game->PlaySound(35); angle = Angle(Ghost_X+8, Ghost_Y, Link->X, Link->Y); Aquamentus_Waitframes(this, ghost, vars, 60); for(int k = 0; k<16; k++){ for(int j=0; j<3; j++){ eweapon e = FireEWeapon(EW_FIREBALL, Ghost_X + 8, Ghost_Y, DegtoRad(angle + Rand(-30, 30)), 150, ghost->WeaponDamage, 35, 13, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 120); SetEWeaponDeathEffect(e, EWD_VANISH, NULL); } Aquamentus_Waitframes(this, ghost, vars, 6); } vars[V_STATE] = 2; } else if(Attack == 2){ vars[V_STATE] = 3; Aquamentus_Waitframes(this, ghost, vars, 15); for(int i = -45; i<=45; i+=45){ eweapon e = FireAimedEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(i), 200, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING_REAIM, 2, 60); } Aquamentus_Waitframes(this, ghost, vars, 15); vars[V_STATE] = 2; } else if(Attack == 3){ vars[V_STATE] = 3; Aquamentus_Waitframes(this, ghost, vars, 15); for(int i = 0; i<=315; i+=45){ eweapon e = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(i), 200, ghost->WeaponDamage, 17, 40, EWF_UNBLOCKABLE); SetEWeaponMovement(e, EWM_HOMING_REAIM, 1, 20); } Aquamentus_Waitframes(this, ghost, vars, 15); vars[V_STATE] = 2; } } do{ Xloc = GridX(Rand(32, 308)); Yloc = GridY(Rand(32, 128)); } while(Screen->ComboD[ComboAt(Xloc, Yloc)] != 5980 || Screen->ComboD[ComboAt(Xloc, Yloc)+1] != 5980 || Distance(Xloc, Yloc, Link->X, Link->Y) < 32); while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 1.5, 0); Aquamentus_Waitframe(this, ghost, vars); } angle = Angle(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y); if((angle > 90 && angle <=180) || (angle >= -180 && angle <=-90)) emergedir = 0; else emergedir = 1; Submerge(Xloc, Yloc, emergedir, false, this, ghost, vars); } } void UpdateData(ffc this, npc ghost, int vars){ int Linkangle = Angle(Ghost_X+8, Ghost_Y+8, Link->X, Link->Y); if((Linkangle > 90 && Linkangle <=180) || (Linkangle >= -180 && Linkangle <=-90)){ vars[1] = 0; if(vars[0] == 0){ //Lava, not firing if(Ghost_Data != 5704){ Ghost_Transform(this, ghost, 5704, 8, 2, 1); Ghost_SetHitOffsets(ghost, 0, 0, 0, 13); } } if(vars[0] == 1){ //Lava, firing if(Ghost_Data != 5705){ Ghost_Transform(this, ghost, 5705, 8, 2, 1); Ghost_SetHitOffsets(ghost, 0, 0, 0, 13); } } if(vars[0] == 2){ //Flying, not firing if(Ghost_Data != 5706){ Ghost_Transform(this, ghost, 5706, 8, 2, 2); } } if(vars[0] == 3){ //Flying, firing if(Ghost_Data != 5707){ Ghost_Transform(this, ghost, 5707, 8, 2, 2); } } } else{ vars[1] = 2; if(vars[0] == 0){ //Lava, not firing if(Ghost_Data != 5700){ Ghost_Transform(this, ghost, 5700, 8, 2, 1); Ghost_SetHitOffsets(ghost, 0, 0, 13, 0); } } if(vars[0] == 1){ //Lava, firing if(Ghost_Data != 5701){ Ghost_Transform(this, ghost, 5701, 8, 2, 1); Ghost_SetHitOffsets(ghost, 0, 0, 13, 0); } } if(vars[0] == 2){ //Flying, not firing if(Ghost_Data != 5702){ Ghost_Transform(this, ghost, 5702, 8, 2, 2); } } if(vars[0] == 3){ //Flying, firing if(Ghost_Data != 5703){ Ghost_Transform(this, ghost, 5703, 8, 2, 2); } } } } void Emerge(int x, int y, int dir, bool flying, ffc this, npc ghost, int vars){ if(!flying){ for(int i = 0; i<30; i++){ Screen->FastCombo(2, x+8, y, 5660, 8, OP_OPAQUE); Aquamentus_Waitframe(this, ghost, vars); } for(int i = 0; i<16; i++){ Screen->SetRenderTarget(RT_BITMAP1); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap if(dir == 0) Screen->DrawCombo(0, 0, 16-i, 5705, 2, 1, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); else Screen->DrawCombo(0, 0, 16-i, 5701, 2, 1, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); Screen->FastCombo(0, 0, 16, Screen->ComboD[ComboAt(x, y+16)], Screen->ComboC[ComboAt(x, y+16)], OP_OPAQUE); Screen->FastCombo(0, 16, 16, Screen->ComboD[ComboAt(x, y+16)+1], Screen->ComboC[ComboAt(x, y+16)+1], OP_OPAQUE); Screen->SetRenderTarget(RT_SCREEN); Screen->DrawBitmap(1, RT_BITMAP1, 0, 0, 32, 32, x, y, 32, 32, 0, true); Aquamentus_Waitframe(this, ghost, vars); } // for(int i = 0; i<16; i++){ // if(dir == 0) // Screen->DrawCombo(0, x, y, 5705, 2, 1, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); // else // Screen->DrawCombo(0, x, y, 5701, 2, 1, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); // Aquamentus_Waitframe(this, ghost, vars); // } Ghost_X = x; Ghost_Y = y; vars[0] = 0; } else{ for(int i = 0; i<30; i++){ Screen->FastCombo(2, x+8, y+16, 5660, 8, OP_OPAQUE); Aquamentus_Waitframe(this, ghost, vars); } for(int i = 0; i<32; i++){ Screen->SetRenderTarget(RT_BITMAP1); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap if(dir == 0) Screen->DrawCombo(0, 0, 32-i, 5707, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); else Screen->DrawCombo(0, 0, 32-i, 5703, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); Screen->FastCombo(0, 0, 32, Screen->ComboD[ComboAt(x, y+32)], Screen->ComboC[ComboAt(x, y+32)], OP_OPAQUE); Screen->FastCombo(0, 16, 32, Screen->ComboD[ComboAt(x, y+32)+1], Screen->ComboC[ComboAt(x, y+32)+1], OP_OPAQUE); Screen->FastCombo(0, 0, 48, Screen->ComboD[ComboAt(x, y+48)], Screen->ComboC[ComboAt(x, y+48)], OP_OPAQUE); Screen->FastCombo(0, 16, 48, Screen->ComboD[ComboAt(x, y+48)+1], Screen->ComboC[ComboAt(x, y+48)+1], OP_OPAQUE); Screen->SetRenderTarget(RT_SCREEN); Screen->DrawBitmap(1, RT_BITMAP1, 0, 0, 32, 64, x, y, 32, 64, 0, true); Aquamentus_Waitframe(this, ghost, vars); } // for(int i = 0; i<16; i++){ // if(dir == 0) // Screen->DrawCombo(0, x, y, 5707, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); // else // Screen->DrawCombo(0, x, y, 5703, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); // Aquamentus_Waitframe(this, ghost, vars); // } Ghost_X = x; Ghost_Y = y+8; vars[0] = 2; } } void Submerge(int x, int y, int dir, bool flying, ffc this, npc ghost, int vars){ Ghost_X = 300; vars[0] = 4; if(!flying){ for(int i = 16; i>0; i--){ Screen->SetRenderTarget(RT_BITMAP1); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap if(dir == 0) Screen->DrawCombo(0, 0, 16-i, 5705, 2, 1, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); else Screen->DrawCombo(0, 0, 16-i, 5701, 2, 1, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); Screen->FastCombo(0, 0, 16, Screen->ComboD[ComboAt(x, y+16)], Screen->ComboC[ComboAt(x, y+16)], OP_OPAQUE); Screen->FastCombo(0, 16, 16, Screen->ComboD[ComboAt(x, y+16)+1], Screen->ComboC[ComboAt(x, y+16)+1], OP_OPAQUE); Screen->SetRenderTarget(RT_SCREEN); Screen->DrawBitmap(1, RT_BITMAP1, 0, 0, 32, 32, x, y, 32, 32, 0, true); Aquamentus_Waitframe(this, ghost, vars); } for(int i = 0; i<30; i++){ Screen->FastCombo(2, x+8, y, 5660, 8, OP_OPAQUE); Aquamentus_Waitframe(this, ghost, vars); } } else{ for(int i = 32; i>0; i--){ Screen->SetRenderTarget(RT_BITMAP1); Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap if(dir == 0) Screen->DrawCombo(0, 0, 32-i, 5707, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); else Screen->DrawCombo(0, 0, 32-i, 5703, 2, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); Screen->FastCombo(0, 0, 32, Screen->ComboD[ComboAt(x, y+32)], Screen->ComboC[ComboAt(x, y+32)], OP_OPAQUE); Screen->FastCombo(0, 16, 32, Screen->ComboD[ComboAt(x, y+32)+1], Screen->ComboC[ComboAt(x, y+32)+1], OP_OPAQUE); Screen->FastCombo(0, 0, 48, Screen->ComboD[ComboAt(x, y+48)], Screen->ComboC[ComboAt(x, y+48)], OP_OPAQUE); Screen->FastCombo(0, 16, 48, Screen->ComboD[ComboAt(x, y+48)+1], Screen->ComboC[ComboAt(x, y+48)+1], OP_OPAQUE); Screen->SetRenderTarget(RT_SCREEN); Screen->DrawBitmap(1, RT_BITMAP1, 0, 0, 32, 64, x, y, 32, 64, 0, true); Aquamentus_Waitframe(this, ghost, vars); } for(int i = 0; i<30; i++){ Screen->FastCombo(2, x+8, y+16, 5660, 8, OP_OPAQUE); Aquamentus_Waitframe(this, ghost, vars); } } } void Aquamentus_Waitframe(ffc this, npc ghost, int vars){ UpdateData(this, ghost, vars); int FireCombo = vars[2]; int FireTimer = vars[3]; int FireZ = vars[4]; for(int i = 0; i<15; i++){ if(FireCombo[i] > 0){ FireTimer[i]--; if(FireTimer[i] == 0) FireCombo[i] = 0; else{ if(FireZ[i] > 0){ FireZ[i] -= 2; Screen->FastTile(1, ComboX(FireCombo[i]), ComboY(FireCombo[i]), 27401, 7, OP_OPAQUE); Screen->FastCombo(1, ComboX(FireCombo[i]), ComboY(FireCombo[i]) - FireZ[i], 4979, 8, OP_OPAQUE); } else{ Screen->FastCombo(1, ComboX(FireCombo[i]), ComboY(FireCombo[i]) - FireZ[i], 4979, 8, OP_OPAQUE); eweapon e = FireAimedEWeapon(EW_SCRIPT2, ComboX(FireCombo[i]), ComboY(FireCombo[i]), 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } } } if(!Ghost_Waitframe(this, ghost, false, false)){ lweapon explosion; int baseX=Ghost_X+ghost->DrawXOffset; int baseY=(Ghost_Y+ghost->DrawYOffset)-(Ghost_Z+ghost->DrawZOffset); __DeathAnimStart(this, ghost); __DeathAnimSFX(ghost->ID, ghost->X); // if(flash) // __Ghost_FlashCounter=10000; // else __Ghost_FlashCounter=0; // One explosion every 16 frames, 15 times for(int i=0; i<15; i++) { explosion=Screen->CreateLWeapon(LW_BOMBBLAST); explosion->X=baseX+Rand(16*Ghost_TileWidth)-8; explosion->Y=baseY+Rand(16*Ghost_TileHeight)-8; explosion->CollDetection=false; for(int j=0; j<16; j++) { Ghost_SetPosition(this, ghost); // Make sure it doesn't wander off // if(flash) // __Ghost_UpdateFlashing(this, ghost); Ghost_WaitframeLight(this, ghost); } } Ghost_X = 300; // ghost->X = 300; int EnhancedMusic[256]; Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); Game->PlayEnhancedMusic(EnhancedMusic, 1); int Args[8]; if(G[G_POSTBOSSFIVESCENE] == 0){ for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 19) f->Misc[0] = 1; } Ghost_WaitframeLight(this, ghost); Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; Ghost_WaitframeLight(this, ghost); Args[0] = 14; RunFFCScript(8, Args); } else if(G[G_POSTBOSSSIXSCENE] == 0 && G[G_POSTLEVELFIVESCENE] == 1){ for(int i = 1; i<32; i++){ ffc f = Screen->LoadFFC(i); if(f->Script == 19) f->Misc[0] = 1; } Ghost_WaitframeLight(this, ghost); Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; Ghost_WaitframeLight(this, ghost); Args[0] = 17; RunFFCScript(8, Args); } while(CountFFCsRunning(8) > 0) Ghost_WaitframeLight(this, ghost); __DeathAnimEnd(this, ghost); Quit(); } } void Aquamentus_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iFlags[FFCF_TRANS] = false; Ghost_SetFlag(GHF_NORMAL); Ghost_SetFlag(GHF_STUN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_4WAY); Ghost_UnsetFlag(GHF_KNOCKBACK); Ghost_Data = 5708; if(ghost->ID == 200) Ghost_Data = 5712; int originaldata = Ghost_Data; ghost->CollDetection = false; int combox; int comboy; int targetx = Link->X; int targety = Link->Y; if(CountFFCsRunning(66) == 0) RunFFCScript(66, NULL); int tileoffset[8]; int x[8]; int y[8]; int angle[8]; int windcount[8]; int valid[8]; int dist[8]; int vars[] = {tileoffset,x,y,angle,windcount,valid,dist}; int fadeinone = 60; int fadeintwo = 30; if(G[G_DIFFICULTY] == DIF_VHARD){ fadeinone = 40; fadeintwo = 20; } while(true){ int teleportdelay; int safedistanceoffset; if(G[G_DIFFICULTY] == DIF_NORMAL || G[G_DIFFICULTY] == DIF_HARD) teleportdelay = Rand(0, 80); else if(G[G_DIFFICULTY] == DIF_VHARD) teleportdelay = Rand(20, 80); else teleportdelay = 20; int axis; for(int j = 6; j >0; j--){ axis = Choose(1,2); for(int i = 100; i >0; i--){ if(axis == 1){ combox = GridX(Rand(32,223)); comboy = GridY(Link->Y+8); } else if(axis == 2){ comboy = GridY(Rand(32,143)); combox = GridX(Link->X+8); } if(((axis ==1 && Abs(combox-Link->X) > 32) || (axis == 2 && Abs(comboy-Link->Y) >32)) && Screen->ComboT[ComboAt(combox, comboy)] != CT_NOENEMY && Screen->ComboF[ComboAt(combox, comboy)] != CF_NOENEMY && Screen->ComboT[ComboAt(combox, comboy)] != CT_WATER && combox >= 32 && combox < 224 && comboy >= 32 && comboy <144){ break; } } if(((axis ==1 && Abs(combox-Link->X) > 32) || (axis == 2 && Abs(comboy-Link->Y) >32)) && Screen->ComboT[ComboAt(combox, comboy)] != CT_NOENEMY && Screen->ComboF[ComboAt(combox, comboy)] != CF_NOENEMY && Screen->ComboT[ComboAt(combox, comboy)] != CT_WATER&& combox >= 32 && combox < 224 && comboy >= 32 && comboy <144) break; if(j == 1) axis = 0; } if(axis == 0){ do{ combox = GridX(Rand(32,223)); comboy = GridY(Rand(32,143)); } while(Distance(combox, comboy, Link->X, Link->Y) < 48 || Screen->ComboT[ComboAt(combox, comboy)] == CT_NOENEMY || Screen->ComboF[ComboAt(combox, comboy)] == CF_NOENEMY || Screen->ComboT[ComboAt(combox, comboy)] == CT_WATER); } Ghost_X = combox; Ghost_Y = comboy; Ghost_Data = originaldata; Ghost_ForceDir(AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y))); ghost->CollDetection = true; this->Flags[FFCF_TRANS] = true; SlowRobeWaitframes(this, ghost, vars, fadeinone); this->Flags[FFCF_TRANS] = false; SlowRobeWaitframes(this, ghost, vars, fadeintwo); if(ghost->ID == 194){ //Timer eweapon e = FireAimedEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, 0, 150, ghost->WeaponDamage, 149, 40, 0); e->Misc[0] = 2; } else if(ghost->ID == 200){ //Wind int randangle = Rand(0, 180); Robe_CreateCircleWind(Ghost_X, Ghost_Y, randangle, vars); Robe_CreateCircleWind(Ghost_X, Ghost_Y, randangle+180, vars); } else{ //Curse Shot eweapon e = FireEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, DegtoRad(DirAngle(Ghost_Dir)), 360, ghost->WeaponDamage, 145, 106, EWF_ROTATE_360); e->Misc[0] = 1; } SlowRobeWaitframes(this, ghost, vars, fadeintwo); this->Flags[FFCF_TRANS] = true; SlowRobeWaitframes(this, ghost, vars, fadeintwo); Ghost_Data = 5716; ghost->CollDetection = false; if(G[G_DIFFICULTY] != DIF_VHARD) SlowRobeWaitframes(this, ghost, vars, 40+teleportdelay); else SlowRobeWaitframes(this, ghost, vars, teleportdelay); } } void SlowRobeWaitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; i < frames; i++){ if(ghost->ID == 200){ Robe_UpdateCircleWind(ghost, vars); } if(!Ghost_Waitframe(this, ghost, false, false)){ this->Flags[FFCF_TRANS] = false; this->Data = 0; Quit(); } } } int Robe_CreateCircleWind(int X, int Y, int FAngle, int vars){ int x = vars[1]; int y = vars[2]; int angle = vars[3]; int windcount = vars[4]; int valid = vars[5]; int dist = vars[6]; for(int i=0; i<8; i++){ if(valid[i] == 0){ Game->PlaySound(93); x[i] = X; y[i] = Y; angle[i] = FAngle; dist[i] = 0; valid[i] = 1; return i; } } } void Robe_UpdateCircleWind(npc ghost, int vars){ int x = vars[1]; int y = vars[2]; int angle = vars[3]; int windcount = vars[4]; int valid = vars[5]; int dist = vars[6]; int tileoffset = vars[0]; for(int i=0; i<8; i++){ if(valid[i] == 1){ //Circular wind angle[i]++; dist[i]+=0.75; int FAngle = angle[i] + Sin(windcount[0])*16; int X = x[i] + VectorX(dist[i], FAngle); int Y = y[i] + VectorY(dist[i], FAngle); if(Offscreen(X,Y)){ valid[i] = 0; } else{ eweapon e = FireEWeapon(EW_SCRIPT8, X, Y, DegtoRad(FAngle), 0, ghost->WeaponDamage, 13, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); e->Frame = tileoffset[0]; } } else if(valid[i] == 2){ //Bombs eweapon e = FireEWeapon(EW_SCRIPT8, x[i], y[i], 0, 0, ghost->WeaponDamage, 13, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); e->Frame = tileoffset[0]; } else if(valid[i] == 3){ //Detonate Bombs int m = Rand(0,7); int n = m + 4; if(n>7){ n = -1 + (n-7); } for(int j = 7; j >= 0; j--){ if(j!= m && j!= n){ Robe_CreateCircleWind(x[i], y[i], j*45, vars); } } valid[i] = 0; } else if(valid[i] > 3){ //Timed Bomb eweapon e = FireEWeapon(EW_SCRIPT8, x[i], y[i], 0, 0, ghost->WeaponDamage, 13, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); e->Frame = tileoffset[0]; valid[i]--; } } } } ffc script statuseffect{ void run(int duration){ while(true){ if(Link->Action == LA_GOTHURTLAND && G[G_STATUSCOOLDOWN] == 0){ for(int i = Screen->NumEWeapons(); i > 0; i--){ eweapon status = Screen->LoadEWeapon(i); if(status->ID == EW_MAGIC && status->Misc[0] == 1){ if(LinkCollision(status)){ // G[G_DEFCURSE] = 300; G[G_DEFCURSEAPP] = 2; G[G_STATUSCOOLDOWN] = 40; lweapon l = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y); l->UseSprite(146); l->DeadState = l->NumFrames*l->ASpeed; l->CollDetection = false; } } if(status->ID == EW_MAGIC && status->Misc[0] == 2){ if(LinkCollision(status)){ G[G_LIGHTTIMER] -= 600; G[G_STATUSCOOLDOWN] = 40; lweapon l = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y); l->UseSprite(150); l->DeadState = l->NumFrames*l->ASpeed; l->CollDetection = false; } } } } Waitframe(); } } } bool Wizzrobe_Phasing(int X, int Y, bool alwaysphase){ if(alwaysphase) return true; for(int x=0; x<3; x++){ for(int y=0; y<3; y++){ if(Screen->isSolid(X+x*7.5, Y+y*7.5)||IsWater(ComboAt(X+x*7.5, Y+y*7.5))) return true; } } return false; } ffc script FloatingWizzrobe{ bool InScreen(int X, int Y){ if(X>=32&&X<=208&&Y>=32&&Y<=128)return true; else return false; } void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_NORMAL); Ghost_UnsetFlag(GHF_KNOCKBACK); Ghost_SetFlag(GHF_4WAY); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); int DashChance = ghost->Attributes[0]; int ShotCooldown = ghost->Attributes[1]; int DashCooldown = ghost->Attributes[2]; int AttackFreq = ghost->Attributes[3]; int Timer = ghost->Attributes[4]; int Combo = ghost->Attributes[10]; Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1); int Counter; int AttackCooldown = 120; int Dashtimer; if(CountFFCsRunning(66) == 0) RunFFCScript(66, NULL); while(true){ if(!inScreen(Ghost_X, Ghost_Y)) Ghost_Waitframe(this, ghost, true, true); int stepspeed = ghost->Step/2; if(Wizzrobe_Phasing(Ghost_X, Ghost_Y, false)) stepspeed = ghost->Step*1.5; Counter = Ghost_ConstantWalk4(Counter, stepspeed, ghost->Rate, ghost->Homing, ghost->Hunger); //Attack if(AttackCooldown==0&&!Wizzrobe_Phasing(Ghost_X, Ghost_Y, false)){ int Dir = Ghost_Dir; //Attack goes here if(__Ghost_LinedUp(8, false)==Ghost_Dir){ if(Timer == 1){ eweapon e =FireEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, DegtoRad(DirAngle(Ghost_Dir)), 300, ghost->WeaponDamage, 149, 40, 0); e->Misc[0] = 2; } else{ eweapon e =FireEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, DegtoRad(DirAngle(Ghost_Dir)), 300, ghost->WeaponDamage, 145, 106, EWF_ROTATE_360); e->Misc[0] = 1; } // if(e->Dir == DIR_DOWN){ // e->Flip = 2; // } // else if(e->Dir == DIR_LEFT || e->Dir == DIR_RIGHT){ // e->Tile += 1; // if(e->Dir == DIR_LEFT) // e->Flip = 1; // } } //End Attack AttackCooldown = ShotCooldown; } //Diagonal Dash else if(Rand(DashChance)==0&&Dashtimer==0){ stepspeed =ghost->Step*1.5; int Angle = 45+90*Rand(0, 3); int Distance = 16*Rand(2, 3); int TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; int TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; int TargetCombo = ComboAt(TargetX, TargetY); for(int i=0; i<20&&!(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY)); i++){ Angle = 45+90*Rand(0, 3); Distance = 16*Rand(2, 3); //Distance = 32; TargetX = GridX(CenterX(ghost))+VectorX(Distance, Angle)+8; TargetY = GridY(CenterY(ghost))+VectorY(Distance, Angle)+8; TargetCombo = ComboAt(TargetX, TargetY); } if(Ghost_CanPlace(TargetX, TargetY)&&InScreen(TargetX, TargetY) && !Screen->isSolid(TargetX, TargetY) && TargetX >= 32 && TargetX <=208 && TargetY >= 32 && TargetY <= 128){ // Ghost_Data = Combo+4; Ghost_X = GridX(CenterX(ghost)); Ghost_Y = GridY(CenterY(ghost)); int Step = Min(stepspeed, 400); for(int i=0; i0)AttackCooldown--; if(Dashtimer>0)Dashtimer--; Wizzrobe_Waitframe(this, ghost, false); } } } void Wizzrobe_Waitframe(ffc this, npc ghost, bool alwaysphase){ if(Wizzrobe_Phasing(Ghost_X, Ghost_Y, alwaysphase)&&G[G_GLOBALFRAMES]%2==0) ghost->DrawYOffset = -1000; else ghost->DrawYOffset = -2; if(ghost->Stun<=0&&!ClockIsActive()){ Ghost_Waitframe(this, ghost); } else{ while(ghost->Stun>0||ClockIsActive()){ if(Wizzrobe_Phasing(Ghost_X, Ghost_Y, alwaysphase)&&G[G_GLOBALFRAMES]%2==0) ghost->DrawYOffset = -1000; else ghost->DrawYOffset = -2; Ghost_Waitframe(this, ghost); } } } void Wizzrobe_Waitframes(ffc this, npc ghost, bool alwaysphase, int frames){ for(int i=0; iDrawYOffset = -1000; else ghost->DrawYOffset = -2; if(!ClockIsActive()){ Ghost_Waitframe(this, ghost); } else{ while(ClockIsActive()){ if(Wizzrobe_Phasing(Ghost_X, Ghost_Y, alwaysphase)&&G[G_GLOBALFRAMES]%2==0) ghost->DrawYOffset = -1000; else ghost->DrawYOffset = -2; Ghost_Waitframe(this, ghost, true, true); } } } const int MAXLIGHTTIMER = 12600; void CurseTimer(){ if(Game->GetCurLevel() == 9){ if(Link->Item[RING_RIGGS]) Screen->DrawTile(7, 164, -56, 26566, 6, 1, 6, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); else Screen->DrawTile(7, 164, -56, 26560, 6, 1, 6, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Screen->Rectangle(7, 181, -52, 181+61*(G[G_LIGHTTIMER]/G[G_MAXLIGHTTIMER]), -47, 0x7B, 1, 0, 0, 0, true, 128);//242, 129 if(Link->Item[RING_RIGGS]) Screen->DrawTile(7, 164, -56, 26586, 2, 1, 6, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); else Screen->DrawTile(7, 164, -56, 26580, 2, 1, 6, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); if(G[G_SUBSCREENOPEN] == 0){ if(G[G_LIGHTTIMER] > 0) G[G_LIGHTTIMER]--; else{ Link->HP--; if(G[G_GLOBALFRAMES] % 20 == 0) Game->PlaySound(19); } } } } ffc script ArenaBattleNew{ void run(int screen){ if(Screen->State[ST_SECRET]) Quit(); Waitframes(120); int delay; // int MasterArray; int MasterArray[19]; int Array1[] = {239, 239, 239, 239, -15, 236, 236, -5, 56, 56, 56, 240, 240, -15, 237, 237, 237}; int Array2[] = {264, 264, 54, 54, 54, 211, 211, -15, 200, 200, 57, 57, -15, 240, 240, 264, 264, 237}; // if(screen == 1) // MasterArray = Array1; // else // MasterArray = Array2; if(screen==1) memcpy(MasterArray, Array1, 17); else memcpy(MasterArray, Array2, 18); for(int i = 0; i < SizeOfArray(MasterArray)&&MasterArray[i]!=0; i++){ if(MasterArray[i] < 0) delay += Abs(MasterArray[i])*60; else{ for(int j = delay; j >0; j--){ if(Screen->NumNPCs() == 0){ delay = 0; break; } Waitframe(); } while(Screen->NumNPCs() >= 8) Waitframe(); QuickSpawn(MasterArray[i]); delay = 0; } } while(Screen->NumNPCs() > 0) Waitframe(); Screen->TriggerSecrets(); Screen->State[ST_SECRET] = true; Game->PlaySound(27); if(Game->GetCurScreen() == 0x67){ Screen->ComboD[20] = 2936; Screen->ComboD[21] = 2937; } Waitframe(); Quit(); } } ffc script AliyaBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_4WAY); Ghost_Data = 5052; Ghost_Dir = DIR_UP; Ghost_X = 120; Ghost_Y = 80; Ghost_CSet = 6; int FireX[30]; int FireY[30]; int FireTimer[30]; int FireTimerM[30]; int MaxFireTimer = 600; int MidFireTimer = 300; int FireIndex; int vars[] = {FireX, FireY, FireTimer, FireTimerM}; int counter = -1; if(G[G_ALIYAFIGHTPRESCENE] == 0){ G[G_HPDRAIN] = 0; Ghost_Data = 5048; int Music3[] = "Final Fantasy III (1990-04-27)(Square).nsf"; Game->PlayEnhancedMusic(Music3, 14); while(Link->Y < 48){ Link->InputUp = false; Link->InputDown = true; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Aliya_Waitframe(this, ghost, vars); } int R1[] = "Aliya!"; PlayTangoStringGhost(R1, STYLE_RIGGS, 30464, 48, 8, this, ghost); int A1[] = "Prince Riggs... I was hoping I wouldn't have to meet you here."; PlayTangoStringGhost(A1, STYLE_ALIYA, 30684, 48, 8, this, ghost); int R2[] = "Aliya, please, hear me out. I know you're-"; PlayTangoStringGhost(R2, STYLE_RIGGS, 30464, 48, 8, this, ghost); int A2[] = "Save your breath. You and I both know how this conversation will play out. There is nothing you could say that would dissuade me from my duty, nor can I cause you to see reason."; PlayTangoStringGhost(A2, STYLE_ALIYA, 30684, 48, 8, this, ghost); int K1[] = "If you know that, then why are you here?"; PlayTangoStringGhost(K1, STYLE_KELL, 30620, 48, 8, this, ghost); int A3[] = "My duty is to protect the Gerudo people from any further persecution. So long as the Hylians live, that cannot be accomplished. And if the Zora wish to side with them, as they have in the past, then I have no qualms cutting down their prince."; PlayTangoStringGhost(A3, STYLE_ALIYA, 30684, 48, 8, this, ghost); int K2[] = "I'm not taking any sides. I'm just trying to stop the bloodshed."; PlayTangoStringGhost(K2, STYLE_KELL, 30620, 48, 8, this, ghost); int A4[] = "As am I. No matter the cost. And if that means I must be the one to strike down another Gerudo Prince... then so be it."; PlayTangoStringGhost(A4, STYLE_ALIYA, 30684, 48, 8, this, ghost); int R3[] = "Aliya, just listen to me! We want the same thing here! We can still create a future for the Gerudo without resorting to murder!"; PlayTangoStringGhost(R3, STYLE_RIGGS, 30464, 48, 8, this, ghost); int A5[] = "No, Riggs, you know nothing. You try to see the best in people. But they deserve so much less. The moment it becomes convenient to them, the Hylians will turn on you. All the other races will follow. This is how it's always been."; PlayTangoStringGhost(A5, STYLE_ALIYA, 30684, 48, 8, this, ghost); int K3[] = "I have no such intentions, and last I checked, I wasn't a Gerudo."; PlayTangoStringGhost(K3, STYLE_KELL, 30620, 48, 8, this, ghost); int A6[] = "Your late mother said much the same thing. I came to her for help, 100 years ago. Do you know what she told me then? She said it was best for the Zora not to become involved in external affairs. Act as self-righteous as you like, 'Prince' Kell. But you and your bloodline are no different from the rest of them."; PlayTangoStringGhost(A6, STYLE_ALIYA, 30684, 48, 8, this, ghost); int R4[] = "What someone else did doesn't mean anything! Aliya, are you even listening to what you're saying?"; PlayTangoStringGhost(R4, STYLE_RIGGS, 30464, 48, 8, this, ghost); int A7[] = "... No matter who walks away from this fight Riggs, know that everything I did, I did for our people."; PlayTangoStringGhost(A7, STYLE_ALIYA, 30684, 48, 8, this, ghost); G[G_ALIYAFIGHTPRESCENE] = 1; Ghost_Data = 5052; } int Music[] = "R6 - Final Boss 1.nsf"; Game->PlayEnhancedMusic(Music, 0); if(CountFFCsRunning(66) == 0) RunFFCScript(66, NULL); int Attack; int LastAttack = -1;; int Xloc; int Yloc; Aliya_Waitframes(this, ghost, vars, 60); while(true){ do{ Attack = Rand(0, 5); } while(Attack == LastAttack || (Attack == 1 && Screen->NumNPCs() > 2)); LastAttack = Attack; if(Attack == 0){ if(Distance(Ghost_X, Ghost_Y, Link->X, Link->Y) < 48){ do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 64); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)); while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 5, 0); Aliya_Waitframe(this, ghost, vars); } } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data += 4; eweapon Chain = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 350, ghost->WeaponDamage, 151, 0, EWF_ROTATE_360); Chain->CollDetection = false; Xloc = Link->X; Yloc = Link->Y; Game->PlaySound(72); int CurHP = Ghost_HP; bool counter; while(Distance(Chain->X, Chain->Y, Xloc, Yloc) > 4){ if(Ghost_HP < CurHP){ counter = true; break; } DrawChain(Chain); Screen->FastTile(2, Chain->X, Chain->Y + 8, 27401, 7, OP_OPAQUE); eweapon e = FireAimedEWeapon(EW_SCRIPT2, Chain->X, Chain->Y, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Aliya_Waitframe(this, ghost, vars); } Chain->Step = 0; for(int i = 0; i< 8 && !counter; i++){ if(Ghost_HP < CurHP){ counter = true; break; } DrawChain(Chain); Chain->Y++; Aliya_Waitframe(this, ghost, vars); } for(int i = 0; i< 15 && !counter; i++){ if(Ghost_HP < CurHP){ counter = true; break; } DrawChain(Chain); Chain->Y++; Aliya_Waitframe(this, ghost, vars); } bool counter2; eweapon Chain2; if(!counter){ Chain2 = FireEWeapon(EW_SCRIPT2, Chain->X, Chain->Y, DegtoRad(Angle(Chain->X, Chain->Y, Ghost_X, Ghost_Y)), 450, ghost->WeaponDamage, 151, 0, 0); Chain2->CollDetection = false; Remove(Chain); Game->PlaySound(100); while(LargeDistance(Chain2->X, Chain2->Y, Ghost_X, Ghost_Y) > 4){ if(Ghost_HP < CurHP){ Xloc = Chain2->X; Yloc = Chain2->Y; Remove(Chain2); counter2 = true; counter = true; break; } eweapon_rotate_180(Chain2); DrawChain(Chain2); eweapon e = FireAimedEWeapon(EW_SCRIPT2, Chain2->X, Chain2->Y, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); if(G[G_GLOBALFRAMES]%4 == 0){ FireX[FireIndex] = Chain2->X; FireY[FireIndex] = Chain2->Y; FireTimer[FireIndex] = MaxFireTimer; FireTimerM[FireIndex] = MaxFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } Aliya_Waitframe(this, ghost, vars); } Remove(Chain2); } if(counter){ int timer; if(!counter2){ while(Chain->isValid() && LargeDistance(Ghost_X, Ghost_Y, Chain->X, Chain->Y) > 4){ DrawChain(Chain); Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Chain->X, Chain->Y), 5, 0); if(G[G_GLOBALFRAMES]%3 == 0){ FireX[FireIndex] = Ghost_X; FireY[FireIndex] = Ghost_Y; FireTimer[FireIndex] = MaxFireTimer; FireTimerM[FireIndex] = MaxFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } timer++; if(timer > 120) break; Aliya_Waitframe(this, ghost, vars); Remove(Chain); } } else{ Chain2 = FireEWeapon(EW_SCRIPT2, Xloc, Yloc, DegtoRad(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)), 0, ghost->WeaponDamage, 151, 0, 0); Chain2->CollDetection = false; timer = 0; while(Chain2->isValid() && LargeDistance(Ghost_X, Ghost_Y, Chain2->X, Chain2->Y) > 4){ DrawChain(Chain2); Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Chain2->X, Chain2->Y), 5, 0); if(G[G_GLOBALFRAMES]%3 == 0){ FireX[FireIndex] = Ghost_X; FireY[FireIndex] = Ghost_Y; FireTimer[FireIndex] = MaxFireTimer; FireTimerM[FireIndex] = MaxFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } timer++; if(timer > 120) break; Aliya_Waitframe(this, ghost, vars); } Remove(Chain2); } Xloc = Link->X; Yloc = Link->Y; Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); timer = 0; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 5, 0); if(G[G_GLOBALFRAMES]%3 == 0){ FireX[FireIndex] = Ghost_X; FireY[FireIndex] = Ghost_Y; FireTimer[FireIndex] = MaxFireTimer; FireTimerM[FireIndex] = MaxFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } timer++; if(timer > 120) break; Aliya_Waitframe(this, ghost, vars); } } Ghost_Data-=4; Aliya_Waitframes(this, ghost, vars, 60); } if(Attack == 1){ Game->PlaySound(21); lweapon spawn = CreateLWeaponAt(LW_SCRIPT6, Ghost_X, Ghost_Y); spawn->UseSprite(22); spawn->Misc[CLW_TIMER] = 12; spawn->CollDetection = false; CreateNPCAt(265, Ghost_X, Ghost_Y); eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 150, 0, 129, 0, 0); e->CollDetection = false; SetEWeaponMovement(e, EWM_THROW, -1, 0); SetEWeaponDeathEffect(e, EWD_VANISH, 0); e->Z = 1; Game->PlaySound(45); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); while(e->Z > 0){ Ghost_X = Clamp(e->X, 32, 208); Ghost_Y = Clamp(e->Y, 32, 128); Ghost_Z = e->Z; Screen->FastTile(2, Ghost_X, Ghost_Y, 27401, 7, OP_OPAQUE); Aliya_Waitframe(this, ghost, vars); } Ghost_Data+=4; for(int i = -16; i<=16; i+=16){ for(int j = -16; j<=16; j+=16){ FireX[FireIndex] = Ghost_X + i; FireY[FireIndex] = Ghost_Y + j; FireTimer[FireIndex] = MidFireTimer; FireTimerM[FireIndex] = MidFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } } Aliya_Waitframes(this, ghost, vars, 30); Ghost_Data-=4; Aliya_Waitframes(this, ghost, vars, 60); } if(Attack == 2){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); if(Distance(Ghost_X, Ghost_Y, Link->X, Link->Y) < 48){ do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 64); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)); while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 5, 0); Aliya_Waitframe(this, ghost, vars); } } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data += 4; for(int i = -60; i<=60; i+=30){ eweapon e = FireAimedEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, DegtoRad(i), 300, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; Aliya_Waitframes(this, ghost, vars, 5); } Aliya_Waitframes(this, ghost, vars, 20); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); for(int i = 0; i<3; i++){ eweapon e = FireAimedEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); SetEWeaponMovement(e, EWM_SINE_WAVE, 20, Rand(15, 40)); e->Misc[0] = 1; Aliya_Waitframes(this, ghost, vars, 15); } Ghost_Data -= 4; Aliya_Waitframes(this, ghost, vars, 60); } if(Attack == 3){ for(int i = 0; i<3; i++){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Xloc = Link->X; Yloc = Link->Y; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 3.5, 0); Aliya_Waitframe(this, ghost, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data += 4; int SwordAngle = DirAngle(Ghost_Dir) + 90; Game->PlaySound(30); for(int i = 0; i<15; i++){ SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5063, 1, 1, 8, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Aliya_Waitframe(this, ghost, vars); } Ghost_Data -= 4; Aliya_Waitframes(this, ghost, vars, 15); } } if(Attack == 4){ eweapon e = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 150, 0, 129, 0, 0); e->CollDetection = false; SetEWeaponMovement(e, EWM_THROW, -1, 0); SetEWeaponDeathEffect(e, EWD_VANISH, 0); e->Z = 1; Game->PlaySound(45); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); while(e->Z > 0){ Ghost_X = Clamp(e->X, 32, 208); Ghost_Y = Clamp(e->Y, 32, 128); Ghost_Z = e->Z; Screen->FastTile(2, Ghost_X, Ghost_Y, 27401, 7, OP_OPAQUE); Aliya_Waitframe(this, ghost, vars); } Ghost_Data+=4; for(int i = -16; i<=16; i+=16){ for(int j = -16; j<=16; j+=16){ FireX[FireIndex] = Ghost_X + i; FireY[FireIndex] = Ghost_Y + j; FireTimer[FireIndex] = MidFireTimer; FireTimerM[FireIndex] = MidFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } } Aliya_Waitframes(this, ghost, vars, 15); Ghost_Data-=4; Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Xloc = Link->X; Yloc = Link->Y; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8){ Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 3.5, 0); Aliya_Waitframe(this, ghost, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data += 4; int SwordAngle = DirAngle(Ghost_Dir) + 90; Game->PlaySound(30); for(int i = 0; i<15; i++){ SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5063, 1, 1, 8, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Aliya_Waitframe(this, ghost, vars); } Ghost_Data -= 4; Aliya_Waitframes(this, ghost, vars, 15); Ghost_Data += 4; Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); eweapon Chain = FireAimedEWeapon(EW_SCRIPT2, Ghost_X, Ghost_Y, 0, 350, ghost->WeaponDamage, 129, 0, EWF_ROTATE_360); Chain->CollDetection = false; Game->PlaySound(37); while(Chain->X > 32 && Chain->Y > 32 && Chain->X < 208 && Chain->Y < 128){ if(G[G_GLOBALFRAMES]%4 == 0){ FireX[FireIndex] = Chain->X; FireY[FireIndex] = Chain->Y; FireTimer[FireIndex] = MidFireTimer; FireTimerM[FireIndex] = MidFireTimer; FireIndex++; if(FireIndex == 30) FireIndex = 0; } Aliya_Waitframe(this, ghost, vars); } Ghost_Data -= 4; Aliya_Waitframes(this, ghost, vars, 60); } if(Attack == 5){ int angle=45+90*Rand(4); int step = 4; int xStep=step*Cos(angle); int yStep=step*Sin(angle); int SwordAngle = DirAngle8(Ghost_Dir); int AngleModifier = 8; Ghost_Data += 4; for(int i = 0; i<300; i++){ if(xStep<0){ if(!Ghost_CanMove(DIR_LEFT, -xStep, 3)) xStep*=-1; } else{ if(!Ghost_CanMove(DIR_RIGHT, xStep, 3)) xStep*=-1; } if(yStep<0){ if(!Ghost_CanMove(DIR_UP, -yStep, 3)) yStep*=-1; } else{ if(!Ghost_CanMove(DIR_DOWN, yStep, 3)) yStep*=-1; } eweapon e = FireEWeapon(EW_SCRIPT1, Ghost_X+VectorX(16, SwordAngle+AngleModifier*i), Ghost_Y+VectorY(16, SwordAngle+AngleModifier*i), 0, 0, ghost->WeaponDamage, 153, 0, EWF_UNBLOCKABLE); e->Tile+=AngleDir8(WrapDegrees(SwordAngle+AngleModifier*i)); SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Ghost_Dir = AngleDir4(WrapDegrees(SwordAngle+AngleModifier*i)); Ghost_MoveXY(xStep, yStep, 3); Aliya_Waitframe(this, ghost, vars); } Ghost_Data -= 4; Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Aliya_Waitframes(this, ghost, vars, 60); } Aliya_Waitframe(this, ghost, vars); } } void DrawChain(eweapon chain){ for(int i = 0; i<20; i++){ Screen->FastTile(1, Ghost_X + VectorX(LargeDistance(Ghost_X, Ghost_Y, chain->X , chain->Y ) * i/20, Angle(Ghost_X, Ghost_Y, chain->X, chain->Y)), Ghost_Y + VectorY(LargeDistance(Ghost_X, Ghost_Y, chain->X , chain->Y ) * i/20, Angle(Ghost_X, Ghost_Y, chain->X, chain->Y)), 30707, 8, OP_OPAQUE); } } void Aliya_Waitframe(ffc this, npc ghost, int vars){ int FireX = vars[0]; int FireY = vars[1]; int FireTimer = vars[2]; int FireTimerM = vars[3]; for(int i = 0; i<30; i++){ if(FireX[i] != 0){ if(FireTimer[i] > 0){ FireTimer[i]--; if(FireTimer[i] > FireTimerM[i]-30 || FireTimerM[i] <= 30){ Screen->FastCombo(2, FireX[i], FireY[i], 5060, 8, OP_OPAQUE); eweapon e = FireAimedEWeapon(EW_SCRIPT2, FireX[i], FireY[i], 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } else{ Screen->DrawCombo(2, FireX[i], FireY[i]-16, 5061, 1, 2, 8, -1, -1, 0, 0, 0, 0, 0, true, OP_OPAQUE); eweapon e = FireAimedEWeapon(EW_SCRIPT2, FireX[i], FireY[i], 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); e = FireAimedEWeapon(EW_SCRIPT2, FireX[i], FireY[i]-16, 0, 0, ghost->WeaponDamage, 129, 0, EWF_UNBLOCKABLE); SetEWeaponLifespan(e, EWL_TIMER, 2); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } else{ FireX[i] = 0; FireY[i] = 0; FireTimerM[i] = 0; } } } if(!Ghost_Waitframe(this, ghost, false, false)){ __DeathAnimStart(this, ghost); __DeathAnimSFX(ghost->ID, ghost->X); Ghost_X = 300; ghost->X = 300; // int EnhancedMusic[256]; // Game->GetDMapMusicFilename(Game->GetCurDMap(), EnhancedMusic); // Game->PlayEnhancedMusic(EnhancedMusic, 1); Game->PlayMIDI(0); int Args[8]; // for(int i = 1; i<32; i++){ // ffc f = Screen->LoadFFC(i); // if(f->Script == 19) // f->Misc[0] = 1; // } // Ghost_WaitframeLight(this, ghost); // Screen->TriggerSecrets(); // Screen->State[ST_SECRET] = true; // Ghost_WaitframeLight(this, ghost); Screen->State[ST_SECRET] = true; Screen->TriggerSecrets(); Args[0] = 20; RunFFCScript(8, Args); while(CountFFCsRunning(8) > 0) Ghost_WaitframeLight(this, ghost); __DeathAnimEnd(this, ghost); Quit(); } } void Aliya_Waitframes(ffc this, npc ghost, int vars, int frames){ for(int i = 0; iWeaponDamage, 145, 106, EWF_ROTATE_360); e->Misc[0] = 1; } Screen->FastTile(2, Ghost_X, Ghost_Y+16, 27401, 7, OP_OPAQUE); Ghost_Waitframe(this, ghost, true, true); } } } void eweapon_rotate_180(eweapon wpn){ int startX=wpn->X; int startY=wpn->Y; bool selfPropelled=true; wpn->DrawXOffset=1000; float endX; float endY; float angle; // Get the angle first if(wpn->Angular) angle=RadtoDeg(wpn->Angle + 90); // else // { // int dir=__NormalizeDir(wpn->Dir); // if(dir==DIR_UP) // angle=-90; // else if(dir==DIR_RIGHTUP) // angle=-45; // else if(dir==DIR_RIGHT) // angle=0; // else if(dir==DIR_RIGHTDOWN) // angle=45; // else if(dir==DIR_DOWN) // angle=90; // else if(dir==DIR_LEFTDOWN) // angle=135; // else if(dir==DIR_LEFT) // angle=180; // else // DIR_LEFTUP // angle=-135; // } if(selfPropelled) { endX=wpn->X+wpn->Step/100*Cos(angle); endY=wpn->Y+wpn->Step/100*Sin(angle); } // else // { // endX=wpn->Misc[__EWI_XPOS]; // endY=wpn->Misc[__EWI_YPOS]; // } // If the weapon's moving, use that angle instead of // wpn->Angle or wpn->Dir if(!(startX==endX && startY==endY)) angle=Angle(startX, startY, endX, endY); int flip; if(angle>=0 && angle<180) flip=0; else flip=2; // Currently, these are always drawn on layer 4. // That should probably be changed... Screen->DrawTile(4, endX, endY-wpn->Z, wpn->Tile, 1, 1, wpn->CSet, -1, -1, endX, endY-wpn->Z, angle, flip, true, OP_OPAQUE); } bool IsFreezable(npc n){ if( n->ID == 187 || n->ID == 186 || n->ID == 297 || n->ID == 177 || n->ID == 296 || n->ID == 295 || n->ID == 180 || n->ID == 185 || n->ID == 298 || n->ID == 188 || n->ID == 243 || n->ID == 299 || n->ID == 300 || n->ID == 302 || n->ID == 303) return false; else return true; } const int C_WHITE = 0x27; const int C_GOLD1 = 0x26; const int C_GOLD2 = 0x25; ffc script ZeldaBoss{ void run(int enemyid){ npc ghost = Ghost_InitAutoGhost(this, enemyid); Ghost_SetFlag(GHF_4WAY); Ghost_Data = 5072; Ghost_CSet = 9; Ghost_Dir = DIR_DOWN; //A lot of this was modified from a Yuurand fight //The vars array is weird cuz I didn't wanna redefine the arrays in a million functions int BulletValid[250]; int BulletX[250]; int BulletY[250]; int BulletSprite[250]; int BulletCenterX[250]; int BulletCenterY[250]; int BulletDistance[250]; int BulletAngle[250]; int BulletTimer[250]; int BulletSpeed[250]; int ClusterCenterX[10]; //For easily moving around masses of bullets, something Yuurand didn't do since the stars always followed fixed paths int ClusterCenterY[10]; //Set BulletCenterX to the negative of the index to tell it it's part of that cluster int V_PHASE = 0; int V_SUPERONE = 1; int V_SUPERTWO = 2; int V_SUPERTHREE = 3; int V_TRIFORCEDISTANCE = 4; int V_TRIFORCEANGLE = 5; int vars[] = {0, 0, 0, 0, 0, 0, BulletValid, BulletX, BulletY, BulletSprite, BulletCenterX, BulletCenterY, BulletDistance, BulletAngle, BulletTimer, BulletSpeed, ClusterCenterX, ClusterCenterY}; npc Triforce[3]; int Attack; int LastAttack = -1;; int Xloc; int Yloc; int CenterIndex; int dist; int ang; int i; int j; int k; int l; int x; int y; if(CountFFCsRunning(66) == 0) RunFFCScript(66, NULL); if(G[G_ZELDAMIDPOINT] == 1){ int Music[] = "R6 - Final Boss 3 NoIntro.nsf"; Game->PlayEnhancedMusic(Music, 0); Ghost_HP = 10000; int SpecialDefenses[18] = {NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK}; Ghost_SetDefenses(ghost, SpecialDefenses); vars[V_PHASE] = 1; Ghost_HP = 10000; Ghost_X = 120; Ghost_Y = 48; Ghost_Dir = DIR_DOWN; for(int i=0; i<3; i++){ Triforce[i] = CreateNPCAt(300, Ghost_X, Ghost_Y); Triforce[i]->Misc[5] = GetNPCNumber(ghost); } for(int i=0; i<20; i++){ vars[V_TRIFORCEANGLE]+=4; vars[V_TRIFORCEDISTANCE]+=1; Zelda_Waitframe(this, ghost, Triforce, vars); } } else{ int Music[] = "R6 - Final Boss 2.nsf"; Game->PlayEnhancedMusic(Music, 0); } Zelda_Waitframes(this, ghost, Triforce, vars, 60); while(true){ if(vars[V_SUPERONE] == 1 || vars[V_SUPERTWO] == 1 || vars[V_SUPERTHREE] == 1) Attack = -1; else{ do{ Attack = Rand(0, 5); } while(Attack == LastAttack || (Attack == 1 && Screen->NumNPCs() > 2)); LastAttack = Attack; } if(Attack == 0){ //Create ring, dash and slash, fire curse shots, create second ring Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data+=4; Zelda_Waitframes(this, ghost, Triforce, vars, 30); j = Rand(5, 50); //Speed k = Rand(240, 500); //Timer l = Rand(0,7); //Tile offset Game->PlaySound(39); for(i = 0; i <= 300; i+=60){ Zelda_CreateBullet(1, Link->X + VectorX(48, i), Link->Y + VectorY(48, i), l, Link->X, Link->Y, 40, i, k, j, vars); } Ghost_Data -= 4; Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Xloc = Link->X; Yloc = Link->Y; k = 0; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8){ k++; if(k == 60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 3.5, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data += 4; int SwordAngle = DirAngle(Ghost_Dir) + 90; Game->PlaySound(30); for(i = 0; i<15; i++){ SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5066, 1, 1, 11, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Data -= 4; Zelda_Waitframes(this, ghost, Triforce, vars, 15); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data += 4; for(i = -60; i<=60; i+=30){ eweapon e = FireAimedEWeapon(EW_MAGIC, Ghost_X, Ghost_Y, DegtoRad(i), 300, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; Zelda_Waitframes(this, ghost, Triforce, vars, 5); } Ghost_Data -= 4; Zelda_Waitframes(this, ghost, Triforce, vars, 20); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data+=4; Zelda_Waitframes(this, ghost, Triforce, vars, 30); j = Rand(5, 50); //Speed k = Rand(240, 500); //Timer l = Rand(0,7); //Tile offset Game->PlaySound(39); for(i = 0; i <= 300; i+=60){ Zelda_CreateBullet(1, Link->X + VectorX(48, i), Link->Y + VectorY(48, i), l, Link->X, Link->Y, 40, i, k, j, vars); } Ghost_Data -= 4; Zelda_Waitframes(this, ghost, Triforce, vars, 60); } if(Attack == 1){ Ghost_Data+=4; int Index = CenterIndex; int Index2 = CenterIndex+1; if(Index2 == 10) Index2 = 0; ClusterCenterX[Index] = Ghost_X + 16; ClusterCenterX[Index2] = Ghost_X - 16; ClusterCenterY[Index] = Ghost_Y; ClusterCenterY[Index2] = Ghost_Y; for(i = 0; i<= 60; i++){ Screen->Circle(3, ClusterCenterX[Index]+8+Rand(-4, 4), ClusterCenterY[Index]+8+Rand(-4, 4), Rand(12, 20), 0x72, 1, 0, 0, 0, true, 64); Screen->Circle(3, ClusterCenterX[Index2]+8+Rand(-4, 4), ClusterCenterY[Index2]+8+Rand(-4, 4), Rand(12, 20), 0x82, 1, 0, 0, 0, true, 64); Zelda_Waitframe(this, ghost, Triforce, vars); } Game->PlaySound(39); k = Rand(5,10); for(Xloc = 0; Xloc<2; Xloc++){ //Ever declare a bunch of variables, run out cuz the original function used several of them but you don't wanna mass replace, and end up using spare variables like this? if(Xloc == 0){ // x = ClusterCenterX[Index]; // y = ClusterCenterY[Index]; x = -1 * Index; } else{ // x = ClusterCenterX[Index2]; // y = ClusterCenterY[Index2]; x = -1 * Index2; } l = Rand(0,7); //Tile offset j = 12; //Distance int TopBullet = Zelda_CreateBullet(25, x + VectorX(j, 90), y + VectorY(j, 90), l, x, y, j, 90, -1, j, vars); //Top bullet int TopLeftBullet = Zelda_CreateBullet(25, x + VectorX(j, 162), y + VectorY(j, 162), l, x, y, j, 162, -1, j, vars); //Top left bullet int BottomLeftBullet = Zelda_CreateBullet(25, x + VectorX(j, 234), y + VectorY(j, 234), l, x, y, j, 234, -1, j, vars); //Bottom left bullet int BottomRightBullet = Zelda_CreateBullet(25, x + VectorX(j, 306), y + VectorY(j, 306), l, x, y, j, 306, -1, j, vars); //Bottom right bullet int TopRightBullet = Zelda_CreateBullet(25, x + VectorX(j, 18), y + VectorY(j, 18), l, x, y, j, 18, -1, j, vars); //Top right bullet int BulletProperty; for(i = 1; i<=2; i++){ //Line from bottom left to top dist = Distance(Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Distance between bullets ang = Angle(Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Angle between bullets BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(BottomLeftBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center } for(i = 1; i<=2; i++){ //Line from bottom right to top dist = Distance(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Distance between bullets ang = Angle(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Angle between bullets BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(BottomRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(BottomRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center } for(i = 1; i<=2; i++){ //Line from bottom right to top left dist = Distance(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Distance between bullets ang = Angle(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Angle between bullets BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(BottomRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(BottomRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center } for(i = 1; i<=2; i++){ //Line from top left to top right dist = Distance(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Distance between bullets ang = Angle(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Angle between bullets BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(TopRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(TopRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center } for(i = 1; i<=2; i++){ //Line from top right to bottom left dist = Distance(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars)); //Distance between bullets ang = Angle(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars)); //Angle between bullets BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(TopRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(TopRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center } } Zelda_Waitframes(this, ghost, Triforce, vars, 60); dist = 16; for(i = 0; i<1440; i+=5){ ClusterCenterX[Index] = Ghost_X + VectorX(dist, i); ClusterCenterY[Index] = Ghost_Y + VectorY(dist, i); ClusterCenterX[Index2] = Ghost_X + VectorX(dist, i+180); ClusterCenterY[Index2] = Ghost_Y + VectorY(dist, i+180); if(i>540) dist+=2; Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Data-=4; ClusterCenterX[Index] = -300; ClusterCenterX[Index2] = -300; CenterIndex+=2; if(CenterIndex >= 10) CenterIndex-=10; } if(Attack == 2){ Ghost_Data+=4; // Game->PlaySound(39); // k = 1; // x = -1 * CenterIndex; // l = Rand(0,7); //Tile offset // j = 64; //Distance // ClusterCenterX[CenterIndex] = Link->X; // ClusterCenterY[CenterIndex] = Link->Y; // int TopBullet = Zelda_CreateBullet(25, ClusterCenterX[CenterIndex] + VectorX(j, 90), ClusterCenterY[CenterIndex] + VectorY(j, 90), l, x, y, j, 90, -1, k, vars); //Top bullet // int TopLeftBullet = Zelda_CreateBullet(25, ClusterCenterX[CenterIndex] + VectorX(j, 162), ClusterCenterY[CenterIndex] + VectorY(j, 162), l, x, y, j, 162, -1, k, vars); //Top left bullet // int BottomLeftBullet = Zelda_CreateBullet(25, ClusterCenterX[CenterIndex] + VectorX(j, 234), ClusterCenterY[CenterIndex] + VectorY(j, 234), l, x, y, j, 234, -1, k, vars); //Bottom left bullet // int BottomRightBullet = Zelda_CreateBullet(25, ClusterCenterX[CenterIndex] + VectorX(j, 306), ClusterCenterY[CenterIndex] + VectorY(j, 306), l, x, y, j, 306, -1, k, vars); //Bottom right bullet // int TopRightBullet = Zelda_CreateBullet(25, ClusterCenterX[CenterIndex] + VectorX(j, 18), ClusterCenterY[CenterIndex] + VectorY(j, 18), l, x, y, j, 18, -1, k, vars); //Top right bullet // int BulletProperty; // for(i = 1; i<=2; i++){ //Line from bottom left to top // dist = Distance(Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Distance between bullets // ang = Angle(Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Angle between bullets // BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(BottomLeftBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); // Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center // } // for(i = 1; i<=2; i++){ //Line from bottom right to top // dist = Distance(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Distance between bullets // ang = Angle(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopBullet, 1, vars), Zelda_GetBulletProperty(TopBullet, 2, vars)); //Angle between bullets // BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(BottomRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(BottomRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); // Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center // } // for(i = 1; i<=2; i++){ //Line from bottom right to top left // dist = Distance(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Distance between bullets // ang = Angle(Zelda_GetBulletProperty(BottomRightBullet, 1, vars), Zelda_GetBulletProperty(BottomRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Angle between bullets // BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(BottomRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(BottomRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); // Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center // } // for(i = 1; i<=2; i++){ //Line from top left to top right // dist = Distance(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Distance between bullets // ang = Angle(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(TopLeftBullet, 1, vars), Zelda_GetBulletProperty(TopLeftBullet, 2, vars)); //Angle between bullets // BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(TopRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(TopRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); // Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center // } // for(i = 1; i<=2; i++){ //Line from top right to bottom left // dist = Distance(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars)); //Distance between bullets // ang = Angle(Zelda_GetBulletProperty(TopRightBullet, 1, vars), Zelda_GetBulletProperty(TopRightBullet, 2, vars), Zelda_GetBulletProperty(BottomLeftBullet, 1, vars), Zelda_GetBulletProperty(BottomLeftBullet, 2, vars)); //Angle between bullets // BulletProperty = Zelda_CreateBullet(25, Zelda_GetBulletProperty(TopRightBullet, 1, vars) + VectorX(dist*(i/3), ang), Zelda_GetBulletProperty(TopRightBullet, 2, vars) + VectorY(dist*(i/3), ang), l, x, y, 0, 18, 0, k, vars); // Zelda_SetBulletProperty(BulletProperty, 6, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 9, Distance(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the distance from the center // Zelda_SetBulletProperty(BulletProperty, 7, Angle(Zelda_GetBulletProperty(BulletProperty, 1, vars), Zelda_GetBulletProperty(BulletProperty, 2, vars), Zelda_GetBulletProperty(BulletProperty, 4, vars), Zelda_GetBulletProperty(BulletProperty, 5, vars)), vars); //Set the angle to the center // } // Zelda_Waitframes(this, ghost, Triforce, vars, 60); // Ghost_Data-=4; // int angle=45+90*Rand(4); // int step = 4; // int xStep=step*Cos(angle); // int yStep=step*Sin(angle); // int AngleModifier = 8; k = 0; int SwordAngle; for(i = 0; i<300; i++){ // if(xStep<0){ // if(!CanWalk(ClusterCenterX[CenterIndex], ClusterCenterY[CenterIndex], DIR_LEFT, -xStep, true)) // xStep*=-1; // } // else{ // if(!CanWalk(ClusterCenterX[CenterIndex], ClusterCenterY[CenterIndex], DIR_RIGHT, xStep, true)) // xStep*=-1; // } // if(yStep<0){ // if(!CanWalk(ClusterCenterX[CenterIndex], ClusterCenterY[CenterIndex], DIR_UP, -yStep, true)) // yStep*=-1; // } // else{ // if(!CanWalk(ClusterCenterX[CenterIndex], ClusterCenterY[CenterIndex], DIR_DOWN, yStep, true)) // yStep*=-1; // } if(k >= 0 && k<10){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data = 5072; Xloc = Link->X; Yloc = Link->Y; k++; } if(k > 0){ if(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8) Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 2.0, 0); else{ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data = 5076; SwordAngle = DirAngle(Ghost_Dir) + 90; k = -30; Game->PlaySound(30); } } if(k < -15){ k++; SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5066, 1, 1, 11, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y), 1.0, 0); } else if(k < 0) k++; // ClusterCenterX[CenterIndex] += xStep; // ClusterCenterY[CenterIndex] += yStep; Zelda_Waitframe(this, ghost, Triforce, vars); } // ClusterCenterX[CenterIndex] = - 300; while(k<0){ k++; SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5066, 1, 1, 11, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Data = 5072; Zelda_Waitframes(this, ghost, Triforce, vars, 90); } if(Attack == 3){ for(i = 0; i<3; i++){ if(i == 1) Zelda_CreateBullet(70, Ghost_X, Ghost_Y, Rand(0,7), Ghost_X, Ghost_Y, -1, -1, Rand(240, 500), -1, vars); do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 64); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)); k = 0; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ k++; if(k>=60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 5, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Data+=4; for(j=0; j<3; j++){ ang = 0; if(j == 0 || j == 1){ eweapon e = FireAimedEWeapon(EW_MAGIC, ghost->X, ghost->Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } else{ if(Rand(1,3) == 1){ ang = Angle(ghost->X, ghost->Y, Link->X + RussInFrontX(Link->Dir, 48), Link->Y + RussInFrontY(Link->Dir, 48)); eweapon e = FireEWeapon(EW_MAGIC, ghost->X, ghost->Y, DegtoRad(ang), 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } else{ eweapon e = FireAimedEWeapon(EW_MAGIC, ghost->X, ghost->Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Zelda_Waitframes(this, ghost, Triforce, vars, 20); } Ghost_Data-=4; Zelda_Waitframes(this, ghost, Triforce, vars, 60); } Zelda_Waitframes(this, ghost, Triforce, vars, 90); } if(Attack == 4){ l = Rand(45,90); // if(l == 45) // k = 90; // else // k = 45; k = l + 60; for(int i = l; i<=l+240; i+=120){ FireJudgmentBeam(Link->X + VectorX(32, i), Link->Y + VectorY(32, i), 60, 180, 8, ghost->WeaponDamage); } for(int i = k; i<=k+240; i+=120){ FireJudgmentBeam(Link->X + VectorX(80, i), Link->Y + VectorY(80, i), 60, 180, 8, ghost->WeaponDamage); } // for(int i = l; i<=l+240; i+=120){ // FireJudgmentBeam(Link->X + VectorX(96, i), Link->Y + VectorY(96, i), 60, 180, 8, ghost->WeaponDamage); // } FireJudgmentBeam(Link->X, Link->Y, 60, 180, 8, ghost->WeaponDamage); Zelda_Waitframes(this, ghost, Triforce, vars, 45); Xloc = Link->X + RussInFrontX(Link->Dir, 48); Yloc = Link->Y + RussInFrontY(Link->Dir, 48); k = 0; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8){ k++; if(k == 60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 2.0, 0); Zelda_Waitframe(this, ghost, Triforce, vars);; } Ghost_Data+=4; for(j=0; j<3; j++){ ang = 0; if(j == 0 || j == 1){ eweapon e = FireAimedEWeapon(EW_MAGIC, ghost->X, ghost->Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } else{ if(Rand(1,3) == 1){ ang = Angle(ghost->X, ghost->Y, Link->X + RussInFrontX(Link->Dir, 48), Link->Y + RussInFrontY(Link->Dir, 48)); eweapon e = FireEWeapon(EW_MAGIC, ghost->X, ghost->Y, DegtoRad(ang), 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } else{ eweapon e = FireAimedEWeapon(EW_MAGIC, ghost->X, ghost->Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Zelda_Waitframes(this, ghost, Triforce, vars, 20); } Ghost_Data-=4; Zelda_Waitframes(this, ghost, Triforce, vars, 60); } if(Attack == 5){ k = 0; int SwordAngle; for(i = 0; i<120; i++){ if(k >= 0 && k<10){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data = 5072; Xloc = Link->X; Yloc = Link->Y; k++; } if(k > 0){ if(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8) Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 2.0, 0); else{ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data = 5076; SwordAngle = DirAngle(Ghost_Dir) + 90; k = -30; Game->PlaySound(30); } } if(k < -15){ k++; SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5066, 1, 1, 11, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y), 1.0, 0); } else if(k < 0) k++; Zelda_Waitframe(this, ghost, Triforce, vars); } while(k<0){ k++; SwordAngle-= 12; Xloc = Ghost_X+VectorX(16, SwordAngle); //Place coords Yloc = Ghost_Y+VectorY(16, SwordAngle); Screen->DrawCombo(1, Xloc, Yloc, 5066, 1, 1, 11, -1, -1, Xloc, Yloc, SwordAngle, -1, 0, true, 128); eweapon e = FireEWeapon(EW_SCRIPT1, Xloc, Yloc, DegtoRad(SwordAngle), 0, ghost->Damage, 129, 0, 0); e->HitWidth+=2; e->HitHeight+=2; //Slightly enlarge the hitbox to make it feel like longer enemy collision and not weapon collision ingame e->HitXOffset-=1; e->HitYOffset-=1; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Data = 5072; do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 64); Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)); k = 0; while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 4){ k++; if(k>=60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 5, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Ghost_Data+=4; for(int i = 0; i<5; i++){ Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); eweapon e = FireJudgmentBeam(Ghost_X, Ghost_Y, 30, 210, 8, ghost->WeaponDamage);; e->Angle = DegtoRad(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); e->Step = 175; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.8), -1); Zelda_Waitframes(this, ghost, Triforce, vars, 20); } Ghost_Data-=4; Zelda_Waitframes(this, ghost, Triforce, vars, 90); } if(vars[V_PHASE] == 0 && Ghost_HP < 10000){ for(i = 0; i< 250; i++){ Zelda_ClearBullet(i, vars); } if(G[G_RANDO] == 0){ do{ Xloc = GridX(Rand(32, 208)); Yloc = GridY(Rand(32, 128)); } while(Distance(Link->X, Link->Y, GridX(Xloc), GridY(Yloc)) < 64); k = 0; Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Xloc, Yloc)); while(Distance(Ghost_X, Ghost_Y, Xloc, Yloc) > 8){ k++; if(k == 60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, Xloc, Yloc), 3.5, 0); Zelda_Waitframe(this, ghost, Triforce, vars); } while(Link->Y < 96){ Link->InputUp = false; Link->InputDown = true; Link->InputLeft = false; Link->InputRight = false; Link->InputStart = false; Link->InputA = false; Link->InputB = false; Link->InputL = false; Link->InputR = false; Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); Link->CollDetection = false; Link->Invisible = true; FireJudgmentBeam(Link->X, Link->Y, 0, 30, 24, 0); int Args[8]; Args[0] = 23; RunFFCScript(72, Args); ffc Zelda = Screen->LoadFFC(3); Zelda->X = Ghost_X; Zelda->Y = Ghost_Y; Ghost_X = 300; while(CountFFCsRunning(72) > 0) Zelda_Waitframe(this, ghost, Triforce, vars); } else{ G[G_ZELDAMIDPOINT] = 1; int Music[] = "R6 - Final Boss 3 NoIntro.nsf"; Game->PlayEnhancedMusic(Music, 0); } int SpecialDefenses[18] = {NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK, NPCDT_BLOCK}; Ghost_SetDefenses(ghost, SpecialDefenses); vars[V_PHASE] = 1; Ghost_HP = 10000; if(G[G_RANDO] == 0){ Ghost_X = 120; Ghost_Y = 48; } Ghost_Dir = DIR_DOWN; for(int i=0; i<3; i++){ Triforce[i] = CreateNPCAt(300, Ghost_X, Ghost_Y); Triforce[i]->Misc[5] = GetNPCNumber(ghost); } for(int i=0; i<20; i++){ vars[V_TRIFORCEANGLE]+=4; vars[V_TRIFORCEDISTANCE]+=1; Zelda_Waitframe(this, ghost, Triforce, vars); } Game->LastEntranceDMap = Game->GetCurDMap(); Game->LastEntranceScreen = Game->GetCurDMapScreen(); } if(vars[V_SUPERONE] == 1){ for(i = 0; i< 250; i++){ Zelda_ClearBullet(i, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, 120, 48)); k = 0; Ghost_SetFlag(GHF_IGNORE_SOLIDITY); while(Distance(Ghost_X, Ghost_Y, 120, 48) > 3){ k++; if(k == 60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, 120, 48), 2, 16); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_UnsetFlag(GHF_IGNORE_SOLIDITY); vars[V_SUPERONE] = 2; Ghost_UnsetFlag(GHF_4WAY); Ghost_Data = 4241; for(i = 0; i<60; i++){ Screen->FastTile(2, Ghost_X, Ghost_Y, 30840, 9, OP_OPAQUE); Zelda_Waitframe(this, ghost, Triforce, vars); } for(i = 30841; i<=30850; i++){ for(j = 0; j<10; j++){ Screen->FastTile(2, Ghost_X, Ghost_Y, i, 9, OP_OPAQUE); Zelda_Waitframe(this, ghost, Triforce, vars); } } Ghost_Data = 5081; Zelda_Waitframes(this, ghost, Triforce, vars, 60); l = -10; for(i = 0; i<1200; i++){ if(i % 60 == 0){ x = Rand(0,7); for(j = l; j< 200 + l; j+= 30){ eweapon e = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, DegtoRad(j), 50, ghost->WeaponDamage, 154, 0, EWF_UNBLOCKABLE); } if(l == -10) l = 0; else if(l == 0) l = 10; else l = -10; } if(i%75 == 0){ for(j = 0; j<2; j++){ x = Rand(40, 216); y = Rand(40, 136); FireJudgmentBeam(x+8, y+8, 30, 60, 12, ghost->WeaponDamage); } } if(Rand(0,120) == 0){ eweapon e = FireAimedEWeapon(EW_MAGIC, ghost->X, ghost->Y, 0, 200, ghost->WeaponDamage, 145, 106, EWF_UNBLOCKABLE|EWF_ROTATE_360); e->Misc[0] = 1; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.5), -1); } Zelda_Waitframe(this, ghost, Triforce, vars); } Zelda_Waitframes(this, ghost, Triforce, vars, 120); Ghost_SetFlag(GHF_4WAY); Ghost_Data = 5072; Ghost_Dir = DIR_DOWN; } if(vars[V_SUPERTWO] == 1){ for(i = 0; i< 250; i++){ Zelda_ClearBullet(i, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, 120, 48)); k = 0; Ghost_SetFlag(GHF_IGNORE_SOLIDITY); while(Distance(Ghost_X, Ghost_Y, 120, 48) > 3){ k++; if(k == 60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, 120, 48), 2, 16); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_UnsetFlag(GHF_IGNORE_SOLIDITY); vars[V_SUPERTWO] = 2; Ghost_UnsetFlag(GHF_4WAY); Ghost_Data = 4241; for(i = 0; i<60; i++){ Screen->FastTile(2, Ghost_X, Ghost_Y, 30840, 9, OP_OPAQUE); Zelda_Waitframe(this, ghost, Triforce, vars); } for(i = 30841; i<=30850; i++){ for(j = 0; j<10; j++){ Screen->FastTile(2, Ghost_X, Ghost_Y, i, 9, OP_OPAQUE); Zelda_Waitframe(this, ghost, Triforce, vars); } } Ghost_Data = 5081; Zelda_Waitframes(this, ghost, Triforce, vars, 60); for(i = 0; i<1200; i++){ if(i % 270 == 0){ l = Rand(0,1); j = (Rand(0, 359)); //Pick an angle x = Rand(0,7); for(k=j; k<= (j + 300); k+=10){ Game->PlaySound(40); Zelda_CreateBullet(61, 120 + VectorX(120, k), 112 + VectorY(120, k), x, 120, 112, 120, k, l, 2, vars); } } if(i%90 == 0){ FireJudgmentBeam(Link->X+8, Link->Y+8, 30, 60, 16, ghost->WeaponDamage); } Zelda_Waitframe(this, ghost, Triforce, vars); } Zelda_Waitframes(this, ghost, Triforce, vars, 120); Ghost_SetFlag(GHF_4WAY); Ghost_Data = 5072; Ghost_Dir = DIR_DOWN; } if(vars[V_SUPERTHREE] == 1){ for(i = 0; i< 250; i++){ Zelda_ClearBullet(i, vars); } Ghost_Dir = AngleDir4(Angle(Ghost_X, Ghost_Y, 120, 48)); k = 0; Ghost_SetFlag(GHF_IGNORE_SOLIDITY); while(Distance(Ghost_X, Ghost_Y, 120, 48) > 3){ k++; if(k == 60) break; Ghost_MoveAtAngle(Angle(Ghost_X, Ghost_Y, 120, 48), 2, 16); Zelda_Waitframe(this, ghost, Triforce, vars); } Ghost_UnsetFlag(GHF_IGNORE_SOLIDITY); vars[V_SUPERTHREE] = 2; Ghost_UnsetFlag(GHF_4WAY); Ghost_Data = 4241; for(i = 0; i<60; i++){ Screen->FastTile(2, Ghost_X, Ghost_Y, 30840, 9, OP_OPAQUE); Zelda_Waitframe(this, ghost, Triforce, vars); } for(i = 30841; i<=30850; i++){ for(j = 0; j<10; j++){ Screen->FastTile(2, Ghost_X, Ghost_Y, i, 9, OP_OPAQUE); Zelda_Waitframe(this, ghost, Triforce, vars); } } Ghost_Data = 5081; Zelda_Waitframes(this, ghost, Triforce, vars, 60); x = 0; for(i = 0; i<1200; i++){ if(i % 120 == 0){ l = Rand(0,1); j = (Rand(0, 359)); //Pick an angle x = Rand(0,7); for(k=j; k<= (j + 315); k+=45){ Game->PlaySound(40); Zelda_CreateBullet(61, Link->X + VectorX(72, k), Link->Y + VectorY(72, k), x, Link->X, Link->Y, 72, k, l, 1, vars); } } if(i%180 == 0) x = 90; if(x>0){ x--; if((x+1) % 30 == 0){ eweapon e = FireJudgmentBeam(Ghost_X, Ghost_Y, 30, 210, 8, ghost->WeaponDamage);; e->Angle = DegtoRad(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y)); e->Step = 125; SetEWeaponMovement(e, EWM_HOMING, DegtoRad(.8), -1); } } Zelda_Waitframe(this, ghost, Triforce, vars); } Zelda_Waitframes(this, ghost, Triforce, vars, 120); Ghost_SetFlag(GHF_4WAY); Ghost_Data = 5072; Ghost_Dir = DIR_DOWN; } if(vars[V_SUPERONE] == 2 && vars[V_SUPERTWO] == 2 && vars[V_SUPERTHREE] == 2 && vars[V_PHASE] != 2){ vars[V_PHASE] = 2; int SpecialDefenses[18] = {NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_BLOCK, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE, NPCDT_NONE}; Ghost_SetDefenses(ghost, SpecialDefenses); Ghost_HP = 2000; } Zelda_Waitframe(this, ghost, Triforce, vars); } } eweapon FireJudgmentBeam(int x, int y, int delay, int duration, int maxradius, int damage){ eweapon e = FireEWeapon(EW_SCRIPT2, x, y, 0, 0, damage, 129, 0, EWF_NO_COLLISION); e->CollDetection = false; e->Misc[0] = delay; e->Misc[1] = duration; e->Misc[3] = maxradius; SetEWeaponLifespan(e, EWL_TIMER, duration+delay+2); SetEWeaponDeathEffect(e, EWD_VANISH, NULL); return e; } void UpdateJudgment(){ for(int i = Screen->NumEWeapons(); i >0; i--){ eweapon e = Screen->LoadEWeapon(i); if(e->ID == EW_SCRIPT2 && e->Misc[1] > 0){ if(e->X < -64 || e->X > 320 || e->Y < -64 || e->Y > 220 || !e->isValid()) Remove(e); if(e->Misc[0] > 0){ Screen->Circle(0, e->X+8, e->Y+8, e->Misc[3], 0x01, 1, 0, 0, 0, true, OP_TRANS); e->Misc[0]--; if(e->Misc[0] == 0) Game->PlaySound(37); } else{ Screen->Circle(0, e->X+8, e->Y+8, e->Misc[3], 0x01, 1, 0, 0, 0, true, OP_TRANS); Screen->Circle(0, e->X+8, e->Y+8, e->Misc[3], 0x01, 1, 0, 0, 0, true, OP_OPAQUE); if(e->Misc[2] < e->Misc[3]) e->Misc[2]++; e->Misc[1]--; int Color = Choose(C_WHITE, C_GOLD1, C_GOLD2); Screen->Circle(0, e->X+8, e->Y+8, e->Misc[2]+Sin(G[G_GLOBALFRAMES]*8)*8, 0x01, 1, 0, 0, 0, true, OP_OPAQUE); Screen->Circle(4, e->X+8, e->Y+8, e->Misc[2], Color, 1, 0, 0, 0, true, OP_OPAQUE); Screen->Rectangle(4, e->X+8-e->Misc[2], 0, e->X+8+e->Misc[2], e->Y+8, Color, 1, 0, 0, 0, true, OP_OPAQUE); if(!Offscreen(e->X+8, e->Y+8)){ if(CircleCollisionLarge(e->X+8, e->Y+8, e->Misc[2], Link->X+8, Link->Y+8, 6)) DamageLink(e->Damage); } } } } } int Zelda_CreateBullet(int valid, int x, int y, int sprite, int centerx, int centery, int distance, int angle, int timer, int speed, int vars){ int BulletValid = vars[6]; int BulletX = vars[7]; int BulletY = vars[8]; int BulletSprite = vars[9]; int BulletCenterX = vars[10]; int BulletCenterY = vars[11]; int BulletDistance = vars[12]; int BulletAngle = vars[13]; int BulletTimer = vars[14]; int BulletSpeed = vars[15]; for(int i=0; i<250; i++){ if(BulletValid[i] == 0){ BulletValid[i] = valid; BulletX[i] = x; BulletY[i] = y; BulletSprite[i] = sprite; BulletCenterX[i] = centerx; BulletCenterY[i] = centery; BulletDistance[i] = distance; BulletAngle[i] = angle; BulletTimer[i] = timer; BulletSpeed[i] = speed; return i; } } } int Zelda_GetBulletProperty(int slot, int property, int vars){ int BulletValid = vars[6]; int BulletX = vars[7]; int BulletY = vars[8]; int BulletSprite = vars[9]; int BulletCenterX = vars[10]; int BulletCenterY = vars[11]; int BulletDistance = vars[12]; int BulletAngle = vars[13]; int BulletTimer = vars[14]; int BulletSpeed = vars[15]; if(property == 0) return BulletValid[slot]; else if(property == 1) return BulletX[slot]; else if(property == 2) return BulletY[slot]; else if(property == 3) return BulletSprite[slot]; else if(property == 4) return BulletCenterX[slot]; else if(property == 5) return BulletCenterY[slot]; else if(property == 6) return BulletDistance[slot]; else if(property == 7) return BulletAngle[slot]; else if(property == 8) return BulletTimer[slot]; else if(property == 9) return BulletSpeed[slot]; } void Zelda_SetBulletProperty(int slot, int property, int value, int vars){ int BulletValid = vars[6]; int BulletX = vars[7]; int BulletY = vars[8]; int BulletSprite = vars[9]; int BulletCenterX = vars[10]; int BulletCenterY = vars[11]; int BulletDistance = vars[12]; int BulletAngle = vars[13]; int BulletTimer = vars[14]; int BulletSpeed = vars[15]; if(property == 0) BulletValid[slot] = value; else if(property == 1) BulletX[slot] = value; else if(property == 2) BulletY[slot] = value; else if(property == 3) BulletSprite[slot] = value; else if(property == 4) BulletCenterX[slot] = value; else if(property == 5) BulletCenterY[slot] = value; else if(property == 6) BulletDistance[slot] = value; else if(property == 7) BulletAngle[slot] = value; else if(property == 8) BulletTimer[slot] = value; else if(property == 9) BulletSpeed[slot] = value; } void Zelda_ClearBullet(int slot, int vars){ int BulletValid = vars[6]; int BulletX = vars[7]; int BulletY = vars[8]; int BulletSprite = vars[9]; int BulletCenterX = vars[10]; int BulletCenterY = vars[11]; int BulletDistance = vars[12]; int BulletAngle = vars[13]; int BulletTimer = vars[14]; int BulletSpeed = vars[15]; BulletValid[slot] = 0; BulletX[slot] = 0; BulletY[slot] = 0; BulletSprite[slot] = 0; BulletCenterX[slot] = 0; BulletCenterY[slot] = 0; BulletDistance[slot] = 0; BulletAngle[slot] = 0; BulletTimer[slot] = 0; BulletSpeed[slot] = 0; } void Zelda_UpdateBullets(npc ghost, int vars){ int BulletValid = vars[6]; //Oh boy... 0 = invalid. 1 = circle wheel. 20-59 = Rotating stars. 60 = expanding rings. Increase second digit to set action. For example, 1 = expanding wheel, 11 = contracting wheel //I'm looking back at this script, which made so much sense at the time in Yuurand, and realizing this is fucking stupid //Whatever. Easier to use this than reinvent the wheel in the two weeks left of the contest //That kind of reasoning is why ZC's blue wizzrobes are the abominations they are, I'm sure int BulletX = vars[7]; int BulletY = vars[8]; int BulletSprite = vars[9]; int BulletCenterX = vars[10]; int BulletCenterY = vars[11]; int BulletDistance = vars[12]; int BulletAngle = vars[13]; int BulletTimer = vars[14]; int BulletSpeed = vars[15]; int ClusterCenterX = vars[16]; int ClusterCenterY = vars[17]; for(int i=0; i<250; i++){ if(BulletValid[i] == 1 || BulletValid[i] == 11){ //Circle Wheel. 1 == expanding, 11 == contracting. if(BulletTimer[i] > 0){ //While it should still be moving BulletCenterX[i] = Link->X; //Center on Link BulletCenterY[i] = Link->Y; BulletAngle[i] += BulletSpeed[i]; //Increase angle if(BulletDistance[i] < 80 && BulletValid[i] == 1) //Expand and contract between distances of 32 and 80, using valid == 1 or 11 as an internal switch BulletDistance[i]++; else if(BulletDistance[i] == 80 && BulletValid[i] == 1){ BulletValid[i] = 11; BulletDistance[i]--; } else if(BulletDistance[i] > 32 && BulletValid[i] == 11) BulletDistance[i]--; else if(BulletDistance[i] == 32 && BulletValid[i] == 11){ BulletDistance[i]++; BulletValid[i] = 1; } BulletX[i] = BulletCenterX[i] + VectorX(BulletDistance[i], BulletAngle[i]); //Position accordingly BulletY[i] = BulletCenterY[i] + VectorY(BulletDistance[i], BulletAngle[i]); BulletTimer[i]--; //Decrease timer } else if(BulletTimer[i] > -60){ //Freeze for 60 seconds if(BulletDistance[i] < 48) BulletDistance[i]++; else BulletTimer[i]--; //Decrease timer } else if(BulletTimer[i] == -60){ //Fire eweapon e = FireEWeapon(EW_SCRIPT8, BulletX[i], BulletY[i], DegtoRad(Angle(BulletX[i], BulletY[i], BulletCenterX[i], BulletCenterY[i])), 200, ghost->WeaponDamage, 154, 0, EWF_UNBLOCKABLE); Zelda_ClearBullet(i, vars); } } else if(BulletValid[i] >= 2 && BulletValid[i] <60){ //Stars of Jesus Christ why am I doing this to myself? if(BulletTimer[i] == -1 && BulletDistance[i] == 12) //Let's... Get... Moving! BulletTimer[i] = 0; else{ if(BulletTimer[i] == 25){ BulletAngle[i] += BulletSpeed[i]; } else{ BulletAngle[i] += 10; if(BulletTimer[i] == 0 && BulletDistance[i] < BulletSpeed[i] + 12) //Pulsations. Here's where it gets dumb BulletDistance[i]++; else if(BulletTimer[i] == 0 && BulletDistance[i] == BulletSpeed[i] + 12) //BulletSpeed is not actually the Bullet's speed in this case BulletTimer[i] = 1; else if(BulletTimer[i] == 1 && BulletDistance[i] > BulletSpeed[i]) //It's the original distance, allowing it to pulse properly BulletDistance[i]--; else if(BulletTimer[i] == 1 && BulletDistance[i] == BulletSpeed[i]) //I ran out of room to stick that variable and didn't want to make a new array. Sue me. BulletTimer[i] = 0; } //All this rolling code is from Yuurand //I don't know if I'm going to use the rolling clusters here, but leaving the code in for now in case I don't. //If I end up not using them and this is still here, then I forgot to remove it //It's far from my worst offense with this boss if(BulletValid[i] == 20 || BulletValid[i] == 30 || BulletValid[i] == 40 || BulletValid[i] == 50){ //Rolling up if(BulletCenterY[i] > -24) //Haven't reached upper limit BulletCenterY[i]--; else{ //Have reached top if(BulletValid[i] == 20){ //Started in upper left if(BulletCenterX[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] += 48; //Move over BulletValid[i] = 21; //And move down } } else if(BulletValid[i] == 30){ //Started in upper right if(BulletCenterX[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] -= 48; //Move over BulletValid[i] = 31; //And move down } } else if(BulletValid[i] == 40){ //Started in lower left if(BulletCenterX[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] += 48; //Move over BulletValid[i] = 41; //And move down } } else if(BulletValid[i] == 50){ //Started in lower right if(BulletCenterX[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] -= 48; //Move over BulletValid[i] = 51; //And move down } } } } else if(BulletValid[i] == 21 || BulletValid[i] == 31 || BulletValid[i] == 41 || BulletValid[i] == 51){ //Rolling down if(BulletCenterY[i] < 208) //Haven't reached lower limit BulletCenterY[i]++; else{ //Have reached top if(BulletValid[i] == 21){ //Started in upper left if(BulletCenterX[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] += 48; //Move over BulletValid[i] = 20; //And move up } } else if(BulletValid[i] == 31){ //Started in upper right if(BulletCenterX[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] -= 48; //Move over BulletValid[i] = 30; //And move up } } else if(BulletValid[i] == 41){ //Started in lower left if(BulletCenterX[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] += 48; //Move over BulletValid[i] = 40; //And move up } } else if(BulletValid[i] == 51){ //Started in lower right if(BulletCenterX[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterX[i] -= 48; //Move over BulletValid[i] = 50; //And move up } } } } else if(BulletValid[i] == 22 || BulletValid[i] == 32 || BulletValid[i] == 42 || BulletValid[i] == 52){ //Rolling left if(BulletCenterX[i] > -24) //Haven't reached lower limit BulletCenterX[i]--; else{ //Have reached top if(BulletValid[i] == 22){ //Started in upper left if(BulletCenterY[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] += 16; //Move over BulletValid[i] = 23; //And move right } } else if(BulletValid[i] == 32){ //Started in upper right if(BulletCenterY[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] += 16; //Move over BulletValid[i] = 33; //And move right } } else if(BulletValid[i] == 42){ //Started in lower left if(BulletCenterY[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] -= 16; //Move over BulletValid[i] = 43; //And move right } } else if(BulletValid[i] == 52){ //Started in lower right if(BulletCenterY[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] -= 16; //Move over BulletValid[i] = 53; //And move right } } } } else if(BulletValid[i] == 23 || BulletValid[i] == 33 || BulletValid[i] == 43 || BulletValid[i] == 53){ //Rolling right if(BulletCenterX[i] < 288) //Haven't reached lower limit BulletCenterX[i]++; else{ //Have reached top if(BulletValid[i] == 23){ //Started in upper left if(BulletCenterY[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] += 16; //Move over BulletValid[i] = 22; //And move left } } else if(BulletValid[i] == 33){ //Started in upper right if(BulletCenterY[i] == 112) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] += 16; //Move over BulletValid[i] = 32; //And move left } } else if(BulletValid[i] == 43){ //Started in lower left if(BulletCenterY[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] -= 16; //Move over BulletValid[i] = 42; //And move left } } else if(BulletValid[i] == 53){ //Started in lower right if(BulletCenterY[i] == 48) //We've reached the end of our journey Zelda_ClearBullet(i, vars); //So DIE. else{ BulletCenterY[i] -= 16; //Move over BulletValid[i] = 52; //And move left } } } } } if(BulletCenterX[i] < 1){ BulletX[i] = ClusterCenterX[-1*BulletCenterX[i]] + VectorX(BulletDistance[i], BulletAngle[i]); //Position accordingly BulletY[i] = ClusterCenterY[-1*BulletCenterX[i]] + VectorY(BulletDistance[i], BulletAngle[i]); if(ClusterCenterX[-1*BulletCenterX[i]] == -300) Zelda_ClearBullet(i, vars); } else{ BulletX[i] = BulletCenterX[i] + VectorX(BulletDistance[i], BulletAngle[i]); //Position accordingly BulletY[i] = BulletCenterY[i] + VectorY(BulletDistance[i], BulletAngle[i]); } } else if(BulletValid[i] == 60){ //Rotating walls if(Distance(BulletX[i], BulletY[i], BulletCenterX[i], BulletCenterY[i]) > 120) Zelda_ClearBullet(i, vars); else{ BulletDistance[i]+=0.25; if(BulletTimer[i] == 0) BulletAngle[i]+=BulletSpeed[i]; else BulletAngle[i]-=BulletSpeed[i]; } BulletX[i] = BulletCenterX[i] + VectorX(BulletDistance[i], BulletAngle[i]); //Position accordingly BulletY[i] = BulletCenterY[i] + VectorY(BulletDistance[i], BulletAngle[i]); } else if(BulletValid[i] == 61){ //Rotating walls inward if(Distance(BulletX[i], BulletY[i], BulletCenterX[i], BulletCenterY[i]) <2) Zelda_ClearBullet(i, vars); else{ BulletDistance[i]-=0.25; if(BulletTimer[i] == 0) BulletAngle[i]+=BulletSpeed[i]; else BulletAngle[i]-=BulletSpeed[i]; } BulletX[i] = BulletCenterX[i] + VectorX(BulletDistance[i], BulletAngle[i]); //Position accordingly BulletY[i] = BulletCenterY[i] + VectorY(BulletDistance[i], BulletAngle[i]); } else if(BulletValid[i] == 70){ if(BulletTimer[i] > 0) BulletTimer[i]--; else{ int dir = Rand(0,1); int j = (Rand(0, 359)); //Pick an angle for(int k=j; k<= (j + 300); k+=10){ Game->PlaySound(40); if(dir==1) Zelda_CreateBullet(60, BulletX[i], BulletY[i], BulletSprite[i], BulletX[i], BulletY[i], 0, k, 1, 2, vars); else Zelda_CreateBullet(60, BulletX[i], BulletY[i], BulletSprite[i], BulletX[i], BulletY[i], 0, k, 0, 2, vars); } Zelda_ClearBullet(i, vars); } } if(BulletValid[i] != 0){ //Cuz charge shots are weird eweapon e = FireEWeapon(EW_SCRIPT8, BulletX[i], BulletY[i], 0, 0, ghost->WeaponDamage,154, 0, EWF_UNBLOCKABLE); e->Tile+=BulletSprite[i]; e->OriginalTile+=BulletSprite[i]; SetEWeaponLifespan(e, EWL_TIMER, 1); SetEWeaponDeathEffect(e, EWD_VANISH, 0); } } } void UpdateTriforce(npc Triforce, int vars){ vars[5]++; for(int i=0; i<3; i++){ int X = Ghost_X+VectorX(vars[4]+Sin(vars[5])*vars[4]/4, vars[5]+120*i); int Y = Ghost_Y+VectorY(vars[4]+Sin(vars[5])*vars[4]/4, vars[5]+120*i); if(Triforce[i]->isValid()){ if(X>-32&&X<272)Triforce[i]->X = X; else Triforce[i]->X = -32; if(Y>-32&&Y<192)Triforce[i]->Y = Y; Screen->FastCombo(2, X, Y, 5082, 5, OP_OPAQUE); } else{ if(vars[i+1] != 2) Screen->FastCombo(2, X, Y, 5083, 5, OP_OPAQUE); if(vars[i+1] == 0) vars[i+1] = 1; } } } void Zelda_Waitframe(ffc this, npc ghost, npc Triforce, int vars){ UpdateJudgment(); Zelda_UpdateBullets(ghost, vars); if(vars[0] == 1) UpdateTriforce(Triforce, vars); if(!Ghost_Waitframe(this, ghost, false, false)){ __DeathAnimStart(this, ghost); __DeathAnimSFX(ghost->ID, ghost->X); ffc Zelda = FindFreeFFC(); Zelda->X = Ghost_X; Zelda->Y = Ghost_Y; Zelda->Data = 5068 + Ghost_Dir; Zelda->CSet = 9; Ghost_WaitframeLight(this, ghost); int Args[8]; Args[0] = 24; RunFFCScript(72, Args); Ghost_Y = -10000; ghost->Y = -10000; __DeathAnimEnd(this, ghost); Quit(); } } void Zelda_Waitframes(ffc this, npc ghost, npc Triforce, int vars, int frames){ for(int i = 0; iPlayEnhancedMusic(Music2, 24); int i; int j; int k; int Hdr1[] = "MAIN QUEST DESIGN"; int HdrX[] = "GRAPHICS FROM"; int Hdr2[] = "ADDITIONAL GRAPHICS"; int Hdr3[] = "MUSIC"; int Hdr4[] = "REMIXERS AND ORIGINAL MUSIC"; int Hdr5[] = "SCRIPTING"; int Hdr6[] = "TESTERS"; int Hdr7[] = "SPECIAL THANKS"; int Au[] = "RUSS"; int G1[] = "KIRBY'S ADVENTURE"; int G2[] = "LEGEND OF ZELDA"; int G3[] = "ORACLE OF AGES/SEASONS"; int G4[] = "STARBOUND"; int AG1[] = "AEVIN"; int AG2[] = "LUT"; int AG3[] = "MASTER MIKE"; int AG4[] = "MOOSH"; int AG5[] = "PRINCEMSC"; int AG6[] = "AND ALL CONTRIBUTORS"; int AG7[] = "TO THE CLASSIC SET"; int M1[] = "CELESTE"; int M2[] = "FINAL FANTASY III"; int M3[] = "HOLLOW KNIGHT"; int M4[] = "KIRBY: CANVAS CURSE"; int M5[] = "THE LEGEND OF ZELDA"; int M6[] = "MEGA MAN 10"; int M7[] = "METROID II: RETURN OF SAMUS"; int M8[] = "SONIC THE HEDGEHOG SERIES"; int M9[] = "SUPER MARIO MAKER 2"; int M10[] = "SUPER METROID"; int M11[] = "SYMPHONY OF THE NIGHT"; int M12[] = "XENOBLADE CHRONICLES"; int M13[] = "ZELDA: BREATH OF THE WILD"; int MR1[] = "BRANFLAKES"; int MR2[] = "DANIEL WHITE (DANOOCT1)"; int MR3[] = "ISABELLE CHIMING"; int MR4[] = "JX"; int MR5[] = "TROJANHORSE711"; int S1[] = "AEVIN"; int S2[] = "MOOSH"; int S3[] = "RUSS"; int S4[] = "SAFFITH"; int T1[] = "AEVIN"; int T2[] = "DIMENTIO"; int T3[] = "EVAN20000"; int T4[] = "MOOSH"; int ST1[] = "AEVIN"; int ST2[] = "MOOSH"; int ST3[] = "ZORIA"; int ST4[] = "AND ALL PARTICIPANTS OF"; int ST5[] = "THE 6TH QUEST CONTEST"; int END1[] = "THE END"; int END2[] = "THANK YOU FOR PLAYING!"; int TIME[] = "TIME:"; int PERCENT[] = "ITEM RATE:"; int NEW[] = "A NEW QUEST BEGINS!"; int RANDO[] = "HOLD L AND EX2 WHILE"; int RANDO2[] = "PRESSING START ON THE TITLE"; int RANDO3[] = "TO UNLOCK RANDOMIZER MODE!"; int Strings[] = {Hdr1, Au, HdrX, G1, G2, G3, G4, Hdr2, AG1, AG2, AG3, AG4, AG5, AG6, AG7, Hdr3, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, Hdr4, MR1, MR2, MR3, MR4, MR5, Hdr5, S1, S2, S3, S4, Hdr6, T1, T2, T3, T4, Hdr7, ST1, ST2, ST3, ST4, ST5}; int StringSpacing[] = {176, 12, 24, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 24, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12}; int StringColor[] = {0x72, 0, 0x72, 0, 0, 0, 0, 0x72, 0, 0, 0, 0, 0, 0, 0, 0x72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x72, 0, 0, 0, 0, 0, 0x72, 0, 0, 0, 0, 0x72, 0, 0, 0, 0, 0x72, 0, 0, 0, 0, 0}; int TrueSpacing[256]; k = 0; int arraysize = SizeOfArray(Strings); for(i=0; i-16; i-=.25){//=0.22 if(i>-176){ Screen->DrawTile(6, 0, 16+i, 62540, 14, 6, 7, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); // Screen->DrawLayer(6, 10, 0x60, 0, 0, i, 0, 128); //Screen->DrawLayer(6, 10, 0x21, 0, 0, i, 0, 128); } for(j=0; j-16&&TrueSpacing[j]+i<176){ k = 0x01; if(StringColor[j]>0) k = StringColor[j]; //drawStringBordered(int layer, int x, int y, int font, int textColor, int borderColor, int alignment, int text, int opacity) drawStringBordered(6, 128, TrueSpacing[j]+i, FONT_Z1, k, 0x00, TF_CENTERED, Strings[j], 128); } } if(i<=-748){ timing-=.25; drawStringBordered(6, 128, 32+timing, FONT_Z1, k, 0x00, TF_CENTERED, END1, 128); Screen->DrawTile(6, 112, 48+timing, 30897, 2, 3, 5, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); drawStringBordered(6, 128, 96+timing, FONT_Z1, k, 0x00, TF_CENTERED, END2, 128); drawStringBordered(6, 32, 120+timing, FONT_Z1, k, 0x00, TF_NORMAL, TIME, 128); DrawTimeHHMMSS(7, 112, 120+timing, FONT_Z1, 0x01, 0x0F, TF_NORMAL, G[G_SUBTIME_HOURS], G[G_SUBTIME_MINS], G[G_SUBTIME_SECS], false); drawStringBordered(6, 32, 144+timing, FONT_Z1, k, 0x00, TF_NORMAL, PERCENT, 128); Screen->DrawInteger(7, 112, 144+timing, FONT_Z1, 0x01, 0x00, -1, -1, percentage*100, 0, OP_OPAQUE); if(timing == 0) break; } WaitI(); } j = 0; // for(i = 176; i>0; i-=.25){ // drawStringBordered(6, 128, 32+i, FONT_Z1, k, 0x00, TF_CENTERED, END1, 128); // Screen->DrawTile(6, 120, 48+i, 30897, 2, 3, 5, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); // drawStringBordered(6, 128, 96+i, FONT_Z1, k, 0x00, TF_CENTERED, END2, 128); // drawStringBordered(6, 32, 120+i, FONT_Z1, k, 0x00, TF_NORMAL, TIME, 128); // DrawTimeHHMMSS(7, 112, 120+i, FONT_Z1, 0x01, 0x0F, TF_NORMAL, G[G_SUBTIME_HOURS], G[G_SUBTIME_MINS], G[G_SUBTIME_SECS], false); // drawStringBordered(6, 32, 144+i, FONT_Z1, k, 0x00, TF_NORMAL, PERCENT, 128); // Screen->DrawInteger(7, 112, 144+i, FONT_Z1, 0x01, 0x00, -1, -1, percentage, 0, OP_OPAQUE); // WaitI(); // } i = 0; while(true){ drawStringBordered(6, 128, 32+i, FONT_Z1, k, 0x00, TF_CENTERED, END1, 128); Screen->DrawTile(6, 112, 48+i, 30897, 2, 3, 5, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); drawStringBordered(6, 128, 96+i, FONT_Z1, k, 0x00, TF_CENTERED, END2, 128); drawStringBordered(6, 32, 120+i, FONT_Z1, k, 0x00, TF_NORMAL, TIME, 128); DrawTimeHHMMSS(7, 112, 120+i, FONT_Z1, 0x01, 0x0F, TF_NORMAL, G[G_SUBTIME_HOURS], G[G_SUBTIME_MINS], G[G_SUBTIME_SECS], false); drawStringBordered(6, 32, 144+i, FONT_Z1, k, 0x00, TF_NORMAL, PERCENT, 128); Screen->DrawInteger(7, 112, 144+i, FONT_Z1, 0x01, 0x00, -1, -1, percentage*100, 0, OP_OPAQUE); if(Link->PressStart || Link->PressA){ WaitI(); break; } WaitI(); } if(G[G_RANDO] == 0){ Game->PlaySound(25); while(true){ drawStringBordered(6, 128, 32+i, FONT_Z1, k, 0x00, TF_CENTERED, END1, 128); Screen->DrawTile(6, 112, 48+i, 30897, 2, 3, 5, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); drawStringBordered(6, 128, 96+i, FONT_Z1, k, 0x00, TF_CENTERED, END2, 128); drawStringBordered(6, 128, 120+i, FONT_Z1, k, 0x00, TF_CENTERED, NEW, 128); drawStringBordered(6, 128, 132+i, FONT_Z1, k, 0x00, TF_CENTERED, RANDO, 128); drawStringBordered(6, 128, 144+i, FONT_Z1, k, 0x00, TF_CENTERED, RANDO2, 128); drawStringBordered(6, 128, 156+i, FONT_Z1, k, 0x00, TF_CENTERED, RANDO3, 128); if(Link->PressStart || Link->PressA) break; WaitI(); } } G[G_STOPTIMER] = 0; G[G_ZELDAMIDPOINT] = 0; Game->Save(); Game->End(); } } int ItemArray[105]; //This array corresponds to the 71 locations items can spawn. These are the D1 value of the ScriptofMiscFunction on the item screens //The values do not directly correlate with item ID, as each must be unique. //0 - Boomerang. 1 - Bracelet. 2 - Bow. 3 - Candle. 4 - Ladder. 5 - Wand. 6 - Ice Tome. 7 - Hookshot. 8 - Lightning Tome. //9 - Remote bombs. 10 - Long bow. 11 - Monster Mirror. 12 - Compass. 13 - Potion Instructions. 14 - Broken Trident. 15 - Broken Chains. //16 - Shield. 17-20 - Four offense upgrades. 21-24 - Four defense upgrades. 25-50 - Twenty-six heart containers. 51-58 - Eight tears of light. //59-65 - Seven magical alloys. 66-69 - Four rupee drops. 70-71 - Two bomb bags. 72-76 - Five more rupee drops from Lynels. 77-82 - Six level 8 keys. //83-101, oh boy. Bomb ammo: 83, 85, 87, 90, 91, 93, 95, 97, 99. 20 rupees: 84, 86, 88, 92, 94, 98. 1 rupee: 89. 50 rupees: 96, 100, 100 //102 - Tri Arrows. 103 - Spectal Lantern. 104 - Wallet. bool Randomizer(bool LynelState, bool TabletState, bool TearState, bool RequiredState, int StatsState, bool JunkState){ if(LynelState) G[G_LYNELRANDO] = 1; if(TabletState) G[G_TABLETRANDO] = 1; if(TearState) G[G_TEARRANDO] = 1; if(RequiredState) G[G_REQUIREDRANDO] = 0; else G[G_REQUIREDRANDO] = 1; if(JunkState) G[G_JUNKRANDO] = 1; G[G_STATSRANDO] = StatsState; int ItemRandomizationArray[105]; for(int i = 0; i= 60 && itemchoice <= 69 && i>=32 && i<=36) //No money or alloys in the shop flag = true; else if(itemchoice >= 77 && itemchoice <= 82 && (i==68||i==69||i==70)) //No tower keys in the tower flag = true; else if(itemchoice >= 51 && itemchoice <= 58 && (i==100||i==101)) //No tears in the castle flag = true; else if((itemchoice == 3 || itemchoice == 103) && (i == 33 || i == 34 || i == 35 || i == 36)){ //No getting both candle and lantern in shop. for(int j = 32; j=1000){ int strcmap1[] = "Max attempts exceeded\n"; printf(strcmap1); break; } } while(ItemRandomizationArray[itemchoice] == 1 || flag == true); ItemArray[i] = itemchoice; ItemRandomizationArray[itemchoice] = 1; } } if(numattempts >= 1000) return false; int strcmap2[] = "Success!n"; printf(strcmap2); for(int i = 0; i<105; i++) Trace(ItemArray[i]); //All items are placed now //No item will be spawned in a location it is required to reach //BUT we haven't accounted for areas in which a combination of items is required to reach //So what we're gonna do is simulate reaching all of them. //We loop through the world, collecting items, making sure everything is ultimately accessible. //If it's not, we need to re-roll the seed. //"Couldn't you just move an offending item, Russ?" //I could, but that requires a much smarter setup than this. bool SimInventory[105]; //Hurray for a simulated inventory! int BranchesExplored[21]; //Were you expecting logic rather than arbitrary values here? Too bad. Why is this one int and the other bool? Because I can't fucking code. bool Discovery; //If we go a full cycle through and don't discover a new item, and we've yet to complete the inventory, then we're stuck and assume seed cannot be completed. bool Success; //If we won or not when we break the loop. int strcmap3[] = "Exploring...\n"; printf(strcmap3); int numloops; // for(int i = 0; i<9; i++) // SimInventory[i] = true; // for(int i = 60; i<66; i++) // SimInventory[i] = true; while(true){ //I feel like making while(true) loops and setting break conditions later isn't normal. But I do it anyways. Discovery = false; if(BranchesExplored[0] == 0){ //Items that can be found from the start, with no additional items BranchesExplored[0] = 1; Discovery = true; SimInventory[ItemArray[0]] = true; SimInventory[ItemArray[1]] = true; SimInventory[ItemArray[2]] = true; SimInventory[ItemArray[19]] = true; SimInventory[ItemArray[21]] = true; SimInventory[ItemArray[37]] = true; SimInventory[ItemArray[38]] = true; SimInventory[ItemArray[39]] = true; SimInventory[ItemArray[41]] = true; SimInventory[ItemArray[45]] = true; SimInventory[ItemArray[48]] = true; SimInventory[ItemArray[52]] = true; SimInventory[ItemArray[72]] = true; SimInventory[ItemArray[73]] = true; SimInventory[ItemArray[74]] = true; SimInventory[ItemArray[77]] = true; SimInventory[ItemArray[83]] = true; SimInventory[ItemArray[84]] = true; SimInventory[ItemArray[85]] = true; SimInventory[ItemArray[86]] = true; SimInventory[ItemArray[87]] = true; SimInventory[ItemArray[88]] = true; } if(BranchesExplored[1] == 0 && SimInventory[0] == true){ //Items that can be found with the boomerang and nothing else BranchesExplored[1] = 1; Discovery = true; SimInventory[ItemArray[3]] = true; SimInventory[ItemArray[4]] = true; SimInventory[ItemArray[40]] = true; SimInventory[ItemArray[46]] = true; SimInventory[ItemArray[47]] = true; } if(BranchesExplored[2] == 0 && SimInventory[1] == true){ //Items that can be found with the bracelet and nothing else BranchesExplored[2] = 1; Discovery = true; SimInventory[ItemArray[5]] = true; SimInventory[ItemArray[6]] = true; SimInventory[ItemArray[7]] = true; SimInventory[ItemArray[49]] = true; SimInventory[ItemArray[50]] = true; } if(BranchesExplored[3] == 0 && SimInventory[2] == true){ //Items that can be found with the bow and nothing else BranchesExplored[3] = 1; Discovery = true; SimInventory[ItemArray[8]] = true; SimInventory[ItemArray[9]] = true; SimInventory[ItemArray[43]] = true; SimInventory[ItemArray[53]] = true; SimInventory[ItemArray[54]] = true; } if(BranchesExplored[4] == 0 && (SimInventory[3] == true || SimInventory[5] == true)){ //Items that can be found with either the candle OR wand and nothing else BranchesExplored[4] = 1; Discovery = true; SimInventory[ItemArray[10]] = true; SimInventory[ItemArray[11]] = true; SimInventory[ItemArray[15]] = true; SimInventory[ItemArray[16]] = true; SimInventory[ItemArray[22]] = true; SimInventory[ItemArray[24]] = true; SimInventory[ItemArray[25]] = true; SimInventory[ItemArray[51]] = true; SimInventory[ItemArray[58]] = true; SimInventory[ItemArray[61]] = true; SimInventory[ItemArray[78]] = true; SimInventory[ItemArray[79]] = true; SimInventory[ItemArray[91]] = true; SimInventory[ItemArray[92]] = true; SimInventory[ItemArray[93]] = true; SimInventory[ItemArray[94]] = true; SimInventory[ItemArray[104]] = true; } if(BranchesExplored[5] == 0 && SimInventory[4] == true){ //Items that can be found with the ladder and nothing else BranchesExplored[5] = 1; Discovery = true; SimInventory[ItemArray[3]] = true; SimInventory[ItemArray[4]] = true; SimInventory[ItemArray[12]] = true; SimInventory[ItemArray[13]] = true; SimInventory[ItemArray[14]] = true; SimInventory[ItemArray[15]] = true; SimInventory[ItemArray[16]] = true; SimInventory[ItemArray[17]] = true; SimInventory[ItemArray[29]] = true; SimInventory[ItemArray[30]] = true; SimInventory[ItemArray[31]] = true; SimInventory[ItemArray[40]] = true; SimInventory[ItemArray[46]] = true; SimInventory[ItemArray[47]] = true; SimInventory[ItemArray[51]] = true; SimInventory[ItemArray[55]] = true; SimInventory[ItemArray[56]] = true; SimInventory[ItemArray[57]] = true; SimInventory[ItemArray[58]] = true; SimInventory[ItemArray[59]] = true; SimInventory[ItemArray[60]] = true; SimInventory[ItemArray[65]] = true; SimInventory[ItemArray[76]] = true; SimInventory[ItemArray[81]] = true; SimInventory[ItemArray[91]] = true; SimInventory[ItemArray[92]] = true; SimInventory[ItemArray[93]] = true; SimInventory[ItemArray[94]] = true; SimInventory[ItemArray[95]] = true; } if(BranchesExplored[6] == 0 && SimInventory[5] == true){ //Items that can be found with the wand but not the candle and nothing else BranchesExplored[6] = 1; Discovery = true; SimInventory[ItemArray[42]] = true; SimInventory[ItemArray[44]] = true; SimInventory[ItemArray[62]] = true; SimInventory[ItemArray[80]] = true; } if(BranchesExplored[7] == 0 && SimInventory[5] == true && SimInventory[6] == true){ //Items that can be found with the wand and ice tome BranchesExplored[7] = 1; Discovery = true; SimInventory[ItemArray[20]] = true; SimInventory[ItemArray[26]] = true; SimInventory[ItemArray[63]] = true; SimInventory[ItemArray[64]] = true; } if(BranchesExplored[8] == 0 && SimInventory[7] == true){ //Items that can be found with the hookshot and nothing else BranchesExplored[8] = 1; Discovery = true; SimInventory[ItemArray[17]] = true; SimInventory[ItemArray[30]] = true; SimInventory[ItemArray[31]] = true; SimInventory[ItemArray[76]] = true; } if(BranchesExplored[9] == 0 && SimInventory[4] == true && SimInventory[7] == true){ //Items that can be found with the ladder and hookshot BranchesExplored[9] = 1; Discovery = true; SimInventory[ItemArray[18]] = true; SimInventory[ItemArray[23]] = true; SimInventory[ItemArray[66]] = true; SimInventory[ItemArray[67]] = true; SimInventory[ItemArray[71]] = true; SimInventory[ItemArray[82]] = true; SimInventory[ItemArray[96]] = true; SimInventory[ItemArray[102]] = true; } if(BranchesExplored[10] == 0 && SimInventory[1] == true && (SimInventory[3] == true || SimInventory[4] == true || SimInventory[5] == true)){ //Items that can be found with the bracelet + either candle/wand/ladder BranchesExplored[10] = 1; Discovery = true; SimInventory[ItemArray[27]] = true; } if(BranchesExplored[11] == 0 && SimInventory[1] == true && SimInventory[4] == true){ //Items that can be found with the bracelet and wand BranchesExplored[11] = 1; Discovery = true; SimInventory[ItemArray[28]] = true; } if(BranchesExplored[12] == 0 && (SimInventory[4] == true || (SimInventory[0] == true && SimInventory[1] == true && SimInventory[2] == true))){ //Items that can be found with the (boomerang, bracelet, and bow) OR the ladder BranchesExplored[12] = 1; Discovery = true; SimInventory[ItemArray[55]] = true; SimInventory[ItemArray[89]] = true; SimInventory[ItemArray[90]] = true; } if(BranchesExplored[13] == 0 && (SimInventory[4] == true || (SimInventory[0] == true && SimInventory[1] == true && SimInventory[2] == true && SimInventory[3] == true))){ //Items that can be found with the (boomerang, bracelet, bow, and candle) OR the ladder BranchesExplored[13] = 1; Discovery = true; SimInventory[ItemArray[56]] = true; SimInventory[ItemArray[57]] = true; } if(BranchesExplored[14] == 0 && SimInventory[4] == true && (SimInventory[3] == true || SimInventory[5] == true) && SimInventory[2] == true && (G[G_TABLETRANDO] == 0 || (SimInventory[77] == true && SimInventory[78] == true && SimInventory[79] == true && SimInventory[80] == true && SimInventory[81] == true && SimInventory[82] == true))){ //Items that can be found with the ladder and candle/wand and bow BranchesExplored[14] = 1; Discovery = true; SimInventory[ItemArray[68]] = true; SimInventory[ItemArray[99]] = true; } if(BranchesExplored[15] == 0 && SimInventory[4] == true && SimInventory[7] == true && (SimInventory[3] == true || SimInventory[5] == true) && SimInventory[2] == true && (G[G_TABLETRANDO] == 0 || (SimInventory[77] == true && SimInventory[78] == true && SimInventory[79] == true && SimInventory[80] == true && SimInventory[81] == true && SimInventory[82] == true))){ //Items that can be found with the ladder, candle/wand, hookshot, and bow BranchesExplored[15] = 1; Discovery = true; SimInventory[ItemArray[69]] = true; SimInventory[ItemArray[70]] = true; } if(BranchesExplored[16] == 0){ //Shop items. Assume you can't buy any until you have enough alloys to buy all to avoid softlock due to user error. int counter; for(int j=59; j<=65; j++){ if(SimInventory[j]) counter++; } if(counter >=5){ BranchesExplored[16] = 1; SimInventory[ItemArray[32]] = true; SimInventory[ItemArray[33]] = true; SimInventory[ItemArray[34]] = true; SimInventory[ItemArray[35]] = true; SimInventory[ItemArray[36]] = true; } } if(BranchesExplored[17] == 0 && (SimInventory[3] == true || SimInventory[4] == true || SimInventory[5] == true)){ //Items that can be found with either the candle OR wand OR ladder and nothing else BranchesExplored[17] = 1; Discovery = true; SimInventory[ItemArray[15]] = true; SimInventory[ItemArray[16]] = true; SimInventory[ItemArray[25]] = true; SimInventory[ItemArray[51]] = true; SimInventory[ItemArray[58]] = true; SimInventory[ItemArray[61]] = true; SimInventory[ItemArray[75]] = true; } if(BranchesExplored[18] == 0 && (G[G_TABLETRANDO] == 0 || (SimInventory[77] == true && SimInventory[78] == true && SimInventory[79] == true && SimInventory[80] == true && SimInventory[81] == true && SimInventory[82] == true))){ //Items that can be found with all tower keys BranchesExplored[18] = 1; Discovery = true; SimInventory[ItemArray[97]] = true; SimInventory[ItemArray[98]] = true; } if(BranchesExplored[19] == 0 && SimInventory[4] == true && SimInventory[7] == true && SimInventory[51] == true && SimInventory[52] == true && SimInventory[53] == true && SimInventory[54] == true && SimInventory[55] == true && SimInventory[56] == true && SimInventory[57] == true && SimInventory[58] == true){ //Items that can be found with the ladder and hookshot and all tears BranchesExplored[19] = 1; Discovery = true; SimInventory[ItemArray[100]] = true; SimInventory[ItemArray[101]] = true; SimInventory[ItemArray[66]] = true; SimInventory[ItemArray[67]] = true; SimInventory[ItemArray[71]] = true; SimInventory[ItemArray[82]] = true; SimInventory[ItemArray[96]] = true; } if(BranchesExplored[20] == 0 && SimInventory[4] == true && SimInventory[5] == true && SimInventory[6] == true){ //Items that can be found with the ladder and wand and ice tome BranchesExplored[20] = 1; Discovery = true; SimInventory[ItemArray[103]] = true; } for(int i = 0; i<105; i++){ if(!SimInventory[i]) break; if(i == 82 && SimInventory[i]){ Success = true; break; } } if(Success) break; if(!Discovery){ int strcmap4[] = "Failed, incompletable seed\n"; printf(strcmap4); int strcmap5[] = "The following items were obtained:\n"; printf(strcmap5); for(int i = 0; i<105; i++){ if(SimInventory[i]) Trace(i); } int strcmap6[] = "The following branches were explored:\n"; printf(strcmap6); for(int i = 0; i<21; i++){ if(BranchesExplored[i] == 1) Trace(i); } return false; } numloops++; Trace(numloops); } int strcmap6[] = "Success! Locations printing:\n"; printf(strcmap6); int strcmap5[] = "Break\n"; for(int i = 0; i<105; i++){ printf(strcmap5); Trace(i); Trace(ItemArray[i]); } //Lastly stats. Make sure we do the same number of srands to ensure the same results for Kell and Riggs even if different options are chosen. if(StatsState == 1){ RandomizeStats(0); int throwaway = srand(80, 200); throwaway = srand(50, 270); throwaway = srand(0,2); } if(StatsState == 2){ int throwaway = srand(80, 200); throwaway = srand(50, 270); throwaway = srand(0,2); RandomizeStats(1); } if(StatsState == 3){ RandomizeStats(0); RandomizeStats(1); } return true; } ffc script RandoMenu{ void run(){ G[G_SEED1] = Rand(1,255); G[G_SEED2] = Rand(1,255); Waitframe(); RandomizationOptionMenu(); G[G_RANDO] = 1; G[G_CUTSCENESDISABLED] = 1; G[G_POSTLEVELONESCENE] = 1; G[G_POSTLEVELTWOSCENE] = 1; G[G_TOWNATTACKONEEXTRO] = 1; G[G_RACISMSCENE] = 1; G[G_GRAVESCENE] = 1; G[G_LEVELFOURENTRANCESCENE] = 1; G[G_LEVELFOURTEARSCENE] = 1; G[G_MIDPOINTSCENE] = 1; G[G_SWIMSCENE] = 1; G[G_RIGGSJOINED] = 1; G[G_POSTLEVELFIVESCENE] = 1; G[G_POSTBOSSFIVESCENE] = 1; G[G_POSTBOSSSIXSCENE] = 1; G[G_POSTLEVELSEVENSCENE] = 1; for(int i = 0; i<8; i++) G[G_TOWERSCENESTART + i] = 1; G[G_ALIYAFIGHTPRESCENE] = 1; G[G_PREZELDASCENE] = 1; G[G_PREZELDASCENETWO] = 1; SetScreenDataForRando(); this->Data = CMB_AUTOWARPA; int String2[] = "Done!"; while(true){ Screen->DrawString(7, 120, 80, FONT_Z3SMALL, 1, 0,TF_CENTERED, String2, OP_OPAQUE); Waitframe(); } } } //0 - Boomerang. 1 - Bracelet. 2 - Bow. 3 - Candle. 4 - Ladder. 5 - Wand. 6 - Ice Tome. 7 - Hookshot. 8 - Lightning Tome. //9 - Remote bombs. 10 - Long bow. 11 - Monster Mirror. 12 - Compass. 13 - Potion Instructions. 14 - Broken Trident. 15 - Broken Chains. //16 - Shield. 17-20 - Four offense upgrades. 21-24 - Four defense upgrades. 25-50 - Twenty-six heart containers. 51-58 - Eight tears of light. //59-65 - Seven magical alloys. 66-69 - Four rupee drops. 70-71 - Two bomb bags. 72-76 - Five more rupee drops from Lynels. 77-82 - Six level 8 keys. int ItemIDToSpawn(int index){ if(index == 0) return 23; if(index == 1) return 19; if(index == 2 || index == 102){ if(Link->Item[13]) return 221; else return 13; } if(index == 3 || index == 103){ if(Link->Item[11]) return 220; else return 11; } if(index == 4) return 27; if(index == 5) return 25; if(index == 6) return 213; if(index == 7) return 52; if(index == 8) return 32; if(index == 9) return 177; if(index == 10) return 68; if(index == 11) return 186; if(index == 12) return 174; if(index == 13) return 209; if(index == 14) return 211; if(index == 15) return 212; if(index == 16) return 8; if(index >= 17 && index <=20) return 198; if(index >= 21 && index <=24) return 199; if(index >= 25 && index <=50) return 28; if(index >= 51 && index <=58){ if(G[G_TEARRANDO] == 0) return 20; else return 217; } if(index >= 59 && index <=65) return 208; if((index >= 66 && index <=69) || (index >= 72 && index <=76)) return 218; if(index == 70 || index == 71) return 82; if(index >= 77 && index <=82) return 219; if(index == 83 || index == 85 || index == 87 || index == 90 || index == 91 || index == 93 || index == 95 || index == 97 || index == 99){ if(G[G_JUNKRANDO] == 1) return 223; else return 3; } if(index == 84 || index == 86 || index == 88 || index == 92 || index == 94 || index == 98){ if(G[G_JUNKRANDO] == 1) return 224; else return 38; } if(index == 96 || index == 100 || index == 101){ if(G[G_JUNKRANDO] == 1) return 218; else return 39; } if(index == 89){ if(G[G_JUNKRANDO] == 1) return 218; else return 0; } // if(index == 102) // return 221; // if(index == 103) // return 220; if(index == 104) return 41; } void RandomizationOptionMenu(){ // int SubscreenShift = -54; int SubscreenShift = 0; int XLoc = 16; int Indent = 8; int Textshift = 16; int Seed1[] = "Seed"; int Dash[] = "-"; int CursorOffset = -1; int SeedEntryState = 0; int OldX; int OldY; int APromptXOffset = -16; int APromptYOffset = -4; int ExtraOffset = -16; int ExtraOffset2 = 8; int CursorPosition = 0; //0 = seed, int CursorTile = 5; int Aprompt = 4277; int IncludeLynels[] = "Include Lynels?"; int IncludeTablets[] = "Include Tablets?"; int RandomStats[] = "Randomize Character Stats?"; int IncludeTears[] = "Include Tears?"; int TearsRequired[] = "All Tears Required?"; int IncludeJunk[] = "Include Junk"; int Start[] = "Start"; int Yes[] = "Yes"; int No[] = "No"; int KellOnly[] = "Kell Only"; int RiggsOnly[] = "Riggs Only"; int Both[] = "Both"; int ExplainSeed[] = "Input a seed. Because seeds may be invalid, your final seed may differ slightly from the numbers entered."; int ExplainLynel[] = "If yes, the five Lynels will be added to the item location pool, and their rupee drops will be mixed in to the pool."; int ExplainTablets[] = "If yes, the tablets that explain the maze path to reach The Tower will be replaced by six keys, which will be mixed into the item pool."; int ExplainTears[] = "If yes, the Tears of Light will be mixed into the item pool."; int ExplainRequired[] = "If no, Hryule Castle will be open as soon as you have infused one Tear of Light. The Timer length is directly proportional to number of Tears infused."; int ExplainStats[] = "This will randomize the character's stats. ATK, DEF, and SPD will always add up to 320 on Normal. May lead to weird results; not recommended."; int ExplainJunk[] = "Bomb and rupees drops in dungeons will be included in the pool. More junk total, but dungeons become more valuable with more potential item spawns."; bool LynelState = 1; bool TabletState = 1; bool TearState = 1; bool RequiredState = false; bool JunkState = 1; int StatsState; bool DisableUp; LaunchTangoSubscreenMessage(ExplainSeed, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); while(true){ Screen->DrawString(2, XLoc, 0 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, Seed1, OP_OPAQUE); Screen->DrawInteger(2, XLoc + Indent, 10 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, -1, -1, G[G_SEED1], 0, OP_OPAQUE); Screen->DrawString(2, XLoc+Indent+16, 10 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Dash, OP_OPAQUE); Screen->DrawInteger(2, XLoc + Indent + 24, 10 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, -1, -1, G[G_SEED2], 0, OP_OPAQUE); Screen->DrawString(2, XLoc, 24 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, IncludeLynels, OP_OPAQUE); if(LynelState) Screen->DrawString(2, XLoc + Indent, 34 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Yes, OP_OPAQUE); else Screen->DrawString(2, XLoc + Indent, 34 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, No, OP_OPAQUE); Screen->DrawString(2, XLoc, 48 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, IncludeTablets, OP_OPAQUE); if(TabletState) Screen->DrawString(2, XLoc + Indent, 58 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Yes, OP_OPAQUE); else Screen->DrawString(2, XLoc + Indent, 58 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, No, OP_OPAQUE); Screen->DrawString(2, XLoc, 72 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, IncludeTears, OP_OPAQUE); if(TearState) Screen->DrawString(2, XLoc + Indent, 82 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Yes, OP_OPAQUE); else Screen->DrawString(2, XLoc + Indent, 82 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, No, OP_OPAQUE); Screen->DrawString(2, XLoc, 96 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, TearsRequired, OP_OPAQUE); if(RequiredState) Screen->DrawString(2, XLoc + Indent, 106 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Yes, OP_OPAQUE); else Screen->DrawString(2, XLoc + Indent, 106 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, No, OP_OPAQUE); Screen->DrawString(2, XLoc, 120 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, RandomStats, OP_OPAQUE); if(StatsState == 0) Screen->DrawString(2, XLoc + Indent, 130 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, No, OP_OPAQUE); else if(StatsState == 1) Screen->DrawString(2, XLoc + Indent, 130 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, KellOnly, OP_OPAQUE); else if(StatsState == 2) Screen->DrawString(2, XLoc + Indent, 130 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, RiggsOnly, OP_OPAQUE); else if(StatsState == 3) Screen->DrawString(2, XLoc + Indent, 130 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Both, OP_OPAQUE); Screen->DrawString(2, XLoc, 144 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x72, -1, TF_NORMAL, IncludeJunk, OP_OPAQUE); if(JunkState) Screen->DrawString(2, XLoc + Indent, 154 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, Yes, OP_OPAQUE); else Screen->DrawString(2, XLoc + Indent, 154 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0xBE, -1, TF_NORMAL, No, OP_OPAQUE); Screen->DrawString(2, XLoc + Indent, 163 + SubscreenShift + Textshift + ExtraOffset, FONT_Z3SMALL, 0x8C, -1, TF_NORMAL, Start, OP_OPAQUE); if(Link->PressUp && !DisableUp){ Game->PlaySound(5); if(CursorPosition == 0) CursorPosition = 7; else CursorPosition--; if(CursorPosition == 0) LaunchTangoSubscreenMessage(ExplainSeed, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 1) LaunchTangoSubscreenMessage(ExplainLynel, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 2) LaunchTangoSubscreenMessage(ExplainTablets, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 3) LaunchTangoSubscreenMessage(ExplainTears, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 4) LaunchTangoSubscreenMessage(ExplainRequired, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 5) LaunchTangoSubscreenMessage(ExplainStats, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 6) LaunchTangoSubscreenMessage(ExplainJunk, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 7) Tango_ClearSlot(0); } if(Link->PressDown && !DisableUp){ Game->PlaySound(5); if(CursorPosition == 7) CursorPosition = 0; else CursorPosition++; if(CursorPosition == 0) LaunchTangoSubscreenMessage(ExplainSeed, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 1) LaunchTangoSubscreenMessage(ExplainLynel, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 2) LaunchTangoSubscreenMessage(ExplainTablets, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 3) LaunchTangoSubscreenMessage(ExplainTears, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 4) LaunchTangoSubscreenMessage(ExplainRequired, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 5) LaunchTangoSubscreenMessage(ExplainStats, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 6) LaunchTangoSubscreenMessage(ExplainJunk, STYLE_SYSTEM, 0, 120-8, 30-10 + SubscreenShift); if(CursorPosition == 7) Tango_ClearSlot(0); } if(CursorPosition == 0){ //Seed //Put stuff for changing seed here if(!DisableUp) Screen->FastCombo(4, XLoc + APromptXOffset, 10 + SubscreenShift + Textshift + CursorOffset + APromptYOffset + ExtraOffset, Aprompt, 7, OP_OPAQUE); else{ if(SeedEntryState == 1){ Screen->DrawTile(3, XLoc, 10 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressUp){ G[G_SEED1]++; } if(Link->PressDown){ G[G_SEED1]--; } if(Link->PressLeft) G[G_SEED1]-=10; if(Link->PressRight) G[G_SEED1]+=10; if(G[G_SEED1]>255) G[G_SEED1]=0; if(G[G_SEED1]<0) G[G_SEED1]=255; if(Link->PressA && Screen->D[2] == 0){ Game->PlaySound(5); SeedEntryState = 2; Screen->D[2] = 1; } } if(SeedEntryState == 2){ Screen->DrawTile(3, XLoc + 24, 10 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressUp){ G[G_SEED2]++; } if(Link->PressDown){ G[G_SEED2]--; } if(Link->PressLeft) G[G_SEED2]-=10; if(Link->PressRight) G[G_SEED2]+=10; if(G[G_SEED2]>255) G[G_SEED2]=0; if(G[G_SEED2]<0) G[G_SEED2]=255; if(Link->PressA && Screen->D[2] == 0){ Game->PlaySound(5); Screen->D[2] = 1; DisableUp = false; } } } if(Link->PressA && Screen->D[2] == 0){ Game->PlaySound(5); DisableUp = true; SeedEntryState = 1; } if(SeedEntryState == 0){ Screen->DrawTile(3, XLoc, 10 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor } } if(CursorPosition == 1){ Screen->DrawTile(3, XLoc, 34 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressLeft || Link->PressRight){ Game->PlaySound(5); LynelState = !LynelState; } } if(CursorPosition == 2){ Screen->DrawTile(3, XLoc, 58 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressLeft || Link->PressRight){ Game->PlaySound(5); TabletState = !TabletState; } } if(CursorPosition == 3){ Screen->DrawTile(3, XLoc, 82 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressLeft || Link->PressRight){ Game->PlaySound(5); TearState = !TearState; } } if(CursorPosition == 4){ Screen->DrawTile(3, XLoc, 106 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressLeft || Link->PressRight){ Game->PlaySound(5); RequiredState = !RequiredState; } } if(CursorPosition == 5){ Screen->DrawTile(3, XLoc, 130 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressLeft){ Game->PlaySound(5); StatsState--; if(StatsState == -1) StatsState = 3; } if(Link->PressRight){ Game->PlaySound(5); StatsState++; if(StatsState == 4) StatsState = 0; } } if(CursorPosition == 6){ Screen->DrawTile(3, XLoc, 154 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor if(Link->PressLeft || Link->PressRight){ Game->PlaySound(5); JunkState = !JunkState; } } if(CursorPosition == 7){ Screen->DrawTile(3, XLoc, 162 + SubscreenShift + Textshift + CursorOffset + ExtraOffset, CursorTile, 1, 1, 4, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Cursor Screen->FastCombo(4, XLoc + APromptXOffset, 160 + SubscreenShift + Textshift + CursorOffset + APromptYOffset + ExtraOffset, Aprompt, 7, OP_OPAQUE); //Aprompt if(Link->PressA || Link->PressStart){ Tango_ClearSlot(0); WaitI(); int String1[] = "Doing a lot of calculations... Please wait."; Screen->DrawString(7, 120, 80, FONT_Z3SMALL, 1, 0,TF_CENTERED, String1, OP_OPAQUE); WaitI(); while(!Randomizer(LynelState, TabletState, TearState, RequiredState, StatsState, JunkState)){ G[G_SEED1]++; if(G[G_SEED1] == 256) G[G_SEED1] = 1; Screen->DrawString(7, 120, 80, FONT_Z3SMALL, 1, 0,TF_CENTERED, String1, OP_OPAQUE); } WaitI(); int strcmap[] = "Your Seed Is: %i (%i)\n"; printf(strcmap, G[G_SEED1], G[G_SEED2]); return; } } if(Link->PressStart && !DisableUp){ CursorPosition = 7; Tango_ClearSlot(0); } Screen->D[2] = 0; G[G_INVISIBLE] = 1; Link->PressStart = false; Link->InputStart = false; Waitframe(); } } void LaunchTangoSubscreenMessage(int message, int style, int slot, int x, int y){ Tango_ClearSlot(slot); Tango_LoadString(slot, message); Tango_SetSlotStyle(slot, style); Tango_SetSlotPosition(slot, x, y); Tango_ActivateSlot(slot); } void SetScreenDataForRando(){ Game->SetScreenState(28, 0x60, ST_SECRET, true); //Reef to graveyard Game->SetScreenState(28, 0x45, ST_SECRET, true); //Level 4 entrance Game->SetScreenState(28, 0x0B, ST_SECRET, true); //Level 8 entrance for(int i = 0; i < 176; i++) { //Burn trigger to get into graveyard Game->SetComboData(29, 0x50, i, Game->GetComboData(11, 0x50,i)); Game->SetComboCSet(29, 0x50, i, Game->GetComboCSet(11, 0x50,i)); Game->SetComboFlag(29, 0x50, i, Game->GetComboFlag(11, 0x50,i)); } for(int i = 0; i < 176; i++) { //Remove blocks in level 2->6 passage Game->SetComboData(2, 0x53, i, Game->GetComboData(2, 0x20,i)); Game->SetComboCSet(2, 0x53, i, Game->GetComboCSet(2, 0x20,i)); Game->SetComboFlag(2, 0x53, i, Game->GetComboFlag(2, 0x20,i)); } ScreenCopy(6, 0x60, 6, 0x00); //Tierra del Fuego if(G[G_TABLETRANDO]){ ScreenCopy(4, 0x00, 11, 0x11); //Tierra del Fuego ScreenCopy(11, 0x0D, 11, 0x0C); //Pacific Cliffs ScreenCopy(8, 0x0D, 8, 0x0C); //Lynel Mob ScreenCopy(8, 0x7C, 8, 0x7D); //Bramble along the coast ScreenCopy(8, 0x28, 8, 0x0C); //Near the desert ScreenCopy(8, 0x04, 8, 0x02); //West of Spectacle Rock } } void RandomizeStats(int which){ int ATK; int DEF; int SPD; int order = srand(0,2); if(order == 0){ SPD = srand(80, 200); ATK = srand(50, 270); while(SPD+ATK > 270) ATK--; DEF = 320 - ATK - SPD; } else if(order == 1){ ATK = srand(50, 270); DEF = srand(50, 270); Trace(ATK); Trace(DEF); while(DEF+ATK > 240){ if(ATK > 50) ATK--; else DEF--; } SPD = 320 - ATK - DEF; } else if(order == 2){ ATK = srand(50, 270); DEF = srand(50, 270); Trace(ATK); Trace(DEF); while(DEF+ATK > 240){ if(DEF > 50) DEF--; else ATK--; } SPD = 320 - ATK - DEF; } if(which == 0){ G[G_KELLATTACK] = ATK; if(DEF < 100) G[G_KELLDEFENSE] = (((100-DEF) * 2) + 100) / 100 * 8; else if(DEF > 100) G[G_KELLDEFENSE] = (((100-DEF) / 2) + 100) / 100 * 8; else G[G_KELLDEFENSE] = 8; G[G_KELLSPEED] = (SPD * 1.5 / 100) - 1.5; G[G_KELLCALCSPEED] = SPD; G[G_KELLCALCDEFENSE] = DEF; Trace(G[G_KELLCALCDEFENSE]); } else if(which == 1){ G[G_RIGGSATTACK] = ATK; if(DEF < 100) G[G_RIGGSDEFENSE] = (((100-DEF) * 2) + 100) / 100 * 8; else if(DEF > 100) G[G_RIGGSDEFENSE] = (((100-DEF) / 2) + 100) / 100 * 8; else G[G_RIGGSDEFENSE] = 8; G[G_RIGGSSPEED] = (SPD * 1.5 / 100) - 1.5; G[G_RIGGSCALCSPEED] = SPD; G[G_RIGGSCALCDEFENSE] = DEF; Trace(G[G_RIGGSCALCDEFENSE]); } }